Help - Rust Book Topic 16.2

Trying to implement the following paragraph stated in the topic 16.2 from Rust Book.

The try_recv method doesn’t block, but will instead return a Result<T, E> immediately: an Ok value holding a message if one is available and an Err value if there aren’t any messages this time. Using try_recv is useful if this thread has other work to do while waiting for messages: We could write a loop that calls try_recv every so often, handles a message if one is available, and otherwise does other work for a little while until checking again.

But the code did not result in receiving the message.

[messageEx]
(rajkrustlearn/messageEx.zip at main · rbalasakuri/rajkrustlearn · GitHub)

Need to know what's wrong in my code.

you have a repository. please use your repository to share your code in text form.

if you do not want to put all your code in a public repo, you can share parts of your code by pasting them, or using the playground, which is nice because it lets people execute the code.

it is very bothersome and potentially dangerous for people to have to download and unzip an unkown zip file to read your code.

3 Likes