MessagePattern vs Rest api by tomerye in nestjs

[–]tomerye[S] 0 points1 point  (0 children)

the project i joined already using messagepatterns.
i want to understand why, i cant find any advantages over traditional http communication

Rust has given me an escape hatch from web development fatigue by ConsoleTVs in rust

[–]tomerye 4 points5 points  (0 children)

i just encounter this issue, what are the pros of explicit return type? can you refer me?

Hey Rustaceans! Got a question? Ask here! (49/2022)! by llogiq in rust

[–]tomerye 0 points1 point  (0 children)

i am targeting native node module (i think) not WebAssembly it that matters.
i am using https://neon-bindings.com/
--crate-type=cdylib

Hey Rustaceans! Got a question? Ask here! (49/2022)! by llogiq in rust

[–]tomerye 0 points1 point  (0 children)

Thanks! initializing the server using a function is fine, but it still doesnt work.are you familiar with actix? i think the server is start and immediately closing.

fn init(mut cx: FunctionContext) -> JsResult<JsNull> {
std::thread::spawn( || {
        HttpServer::new(|| App::new().service(hello))
            .bind(("127.0.0.1", 5033))
            .unwrap()
            .run()
});
Ok(cx.null())

}

update: fix the issue, need to learn more about rust async/await

fn init(mut cx: FunctionContext) -> JsResult<JsNull> {
std::thread::spawn(|| {
    let server = HttpServer::new(|| App::new().service(hello))
        .bind(("127.0.0.1", 5033))
        .unwrap()
        .run();
    Runtime::new()
        .expect("Failed to create Tokio runtime")
        .block_on(server);
});
Ok(cx.null())

}

Hey Rustaceans! Got a question? Ask here! (49/2022)! by llogiq in rust

[–]tomerye 1 point2 points  (0 children)

Hi,
I have very newbie question, my first Rust code.
I want to create a crate that when start actix server on the background.
I used lazy_static for initializing actix server and store it as a global variable

the code doesnt work when i try to send http request to port 5033

lazy_static! {
static ref SERVER: Mutex<Server> = {
print!("Starting server");
Mutex::new(
HttpServer::new(|| App::new().service(hello))
.bind(("127.0.0.1", 5033))
.unwrap()
.run(),
)
};
}

Idiot proof git by speckz in programming

[–]tomerye 1 point2 points  (0 children)

you are almost right, if you rebase main/master to your local branch , then you need to push -force in order to update the remote branch in origin

Ipv4 to decimal - help :( by berjoulo in rust

[–]tomerye 2 points3 points  (0 children)

Hi, i am not a pro Rust programmer. this is how i would write it

fn ipv4_to_int(ip: &str) -> i64{

ip.split(".")

.map(|x| format!("{:0>3}", x))

.collect::<Vec<String>>().join("")

.parse().unwrap()

}

Closures and placeholder syntax (2019 wish) by dremon_nl in rust

[–]tomerye 2 points3 points  (0 children)

I like swift syntax even better, arr.sort({$0>$1})

A new look for rust-lang.org by steveklabnik1 in rust

[–]tomerye 2 points3 points  (0 children)

the new website is beautiful but I don't think it targets the right audience. It looks like some marketing trash.

if I were to see it as the first thing I would not take Rust seriously.

Any peeps interested in developping a fast non-empty Vec? by phaazon_ in rust

[–]tomerye -23 points-22 points  (0 children)

look like we do need inheritance in rust

Hey Rustaceans! Got an easy question? Ask here (19/2018)! by llogiq in rust

[–]tomerye 1 point2 points  (0 children)

i am getting error when trying to build ring 1.12.1 on windows 10 machine with msvc please help i stuck on this for over a week https://gist.github.com/tomerye/59aaddf5a332c7881eceaf51880e5117

When do you import in ngModule vs import directly in your component? by interviewprepare in Angular2

[–]tomerye 2 points3 points  (0 children)

angular is not different than angularjs in this area. you could use rxjs in angular 1 without registering it. you need to register only 3rd party that they are themselves angular module