Help - Rust Book Topic 16.2

โš“ Rust    ๐Ÿ“… 2026-01-02    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 1      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: 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.

2 posts - 2 participants

Read full topic

๐Ÿท๏ธ Rust_feed