How to use while let

Use while let to loop over Option or Result values until they stop matching a specific pattern.

Use while let to loop over an expression that returns an Option or Result, executing the block only when the value matches a specific pattern.

while let Some(value) = rx.recv().await {
    println!("received '{value}'");
}

This loop continues as long as rx.recv().await returns Some(value), automatically stopping when it returns None.