expression
Zero-capacity rendezvous channel
A zero-capacity channel has no queued message slot: successful blocking send requires a receiver to accept the handoff. This establishes receipt, not completion of the work. Expected stdout (not executed): 42 Common mistake: Sending from the only thread before receiving on a zero-capacity channel.
Formal Syntax & Structure
rust syntaxrust
mpsc::sync_channel::<T>(0)Working Example
Example Snippetrust
fn main() { use std::{sync::mpsc, thread}; let (tx, rx) = mpsc::sync_channel(0); let worker = thread::spawn(move || tx.send(42).unwrap()); let value = rx.recv().unwrap(); worker.join().unwrap(); println!("{value}");}