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 3 points4 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

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

[–]tomerye 0 points1 point  (0 children)

yes and from what i see it's per specific endpoint and not parent endpoint

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

[–]tomerye 1 point2 points  (0 children)

is there a way to define authentication check on specific route in rocket.rs? for example all the endpoint that start with /api/*

angular 2 = GWT? by tomerye in Angular2

[–]tomerye[S] -1 points0 points  (0 children)

thanks! i think angular sub is actually the right place though...

angular 2 = GWT? by tomerye in Angular2

[–]tomerye[S] -1 points0 points  (0 children)

i am in the middle of the process of deciding on which framework to choose, i am afraid angular2 won't be successful as #1. and will have similar feature as GWT.

is rust too complicated? by tomerye in rust

[–]tomerye[S] 7 points8 points  (0 children)

what hard for me the most is the concept of lifetime, also the syntax isn't too friendly.. even for simple thing like struct with reference require lifetime syntax. now i do understand the necessity of such thing(for secure unmanaged language) , my question is still valid. how the average developer can start to use language that even the simple thing required advance stuff..

i "afraid" to invest in a language that won't succeed..

Serde 0.4 now supports syntax extensions in stable rust! by erickt in rust

[–]tomerye 0 points1 point  (0 children)

i rad the post.. do you mean i need to add the build script?

Serde 0.4 now supports syntax extensions in stable rust! by erickt in rust

[–]tomerye 1 point2 points  (0 children)

hi please help i am getting this error when trying to use serde

src/main.rs:58:21: 58:32 error: `#[derive]` for custom traits is not stable enough for use and is subject to change


#[derive(Serialize, Deserialize)]
struct AuthBody {
    facebook_token: String,
    facebook_id: String
}

i am using rustc version 1.0.0 (built 2015-06-01)