Newbie - need help

Hi all,

I tried with Rust actix sample code but I do not know what is wrong in this case, may someone please kindly help to explain me, that is really valid to keep me understand grow.

this is my code:

1 Like

It's pub async fn, not async pub fn.

2 Likes

Sorry, i did but the main file still not see the function on the handlers.rs... why that is apprearded...?
Anyway, thanks for your reply :slight_smile:

It's because the functions in handlers.rs are declared as async pub fn instead of pub async fn. The main file doesn't see them because they were not correctly defined.

1 Like

thanks, I did it and adjust some error, it's look good now. there is still a concern for using mpsc::channel(), could you please help me or give me some hints to understand that...

https://github.com/fclinux/actix_basic.git

Please post code and errors in code blocks rather than images.

You can't use the std channel in async code because it is blocking

1 Like

Actually, the library actix::utils::mpsc is not valid now then I'm stupid to replace by the std::sync::mpsc...

I do not know the mechanism of the code then ...

thanks for your sharing, I'm going to make the basic understanding for async in RUST. :slight_smile:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.