std-type

SyncSender<T>: bounded sending endpoint

A SyncSender sends to a channel with fixed message capacity. It is clonable, so many producers can share the capacity. Use try_send when the caller must choose its own overload policy. Expected stdout (not executed): 1 2 Common mistake: Assuming each clone has a separate capacity budget.

Formal Syntax & Structure

rust syntaxrust
SyncSender<T>; send; try_send

Working Example

Example Snippetrust
fn main() {    use std::sync::mpsc;    let (tx, rx) = mpsc::sync_channel(1);    let other = tx.clone();    tx.send(1).unwrap();    println!("{}", rx.recv().unwrap());    other.send(2).unwrap();    println!("{}", rx.recv().unwrap());}
Rust Reference