std-type
Sender<T>: unbounded sending endpoint
The sender can be moved to a worker while the receiver stays with its consumer. The payload type is fixed for the channel. The worker must own or validly borrow everything it captures. Expected stdout (not executed): report Common mistake: Expecting send to borrow an owned payload indefinitely.
Formal Syntax & Structure
rust syntaxrust
Sender<T>; sender.send(value)Working Example
Example Snippetrust
fn main() { use std::{sync::mpsc, thread}; let (tx, rx) = mpsc::channel(); let h = thread::spawn(move || tx.send(String::from("report")).unwrap()); println!("{}", rx.recv().unwrap()); h.join().unwrap();}