std-function
channel: unbounded queue
Create a queue with no configured capacity bound. Sending does not wait for queue space; a producer that outruns its consumer can grow memory use. For controlled buffering, choose sync_channel. Expected stdout (not executed): 6 Common mistake: Assuming an unbounded queue has unlimited physical memory.
Formal Syntax & Structure
rust syntaxrust
mpsc::channel::<T>() -> (Sender<T>, Receiver<T>)Working Example
Example Snippetrust
fn main() { use std::sync::mpsc; let (tx, rx) = mpsc::channel::<u32>(); for n in 1..=3 { tx.send(n).unwrap(); } drop(tx); println!("{}", rx.into_iter().sum::<u32>());}