Send and Sync
The two marker traits that say whether a type may be moved to, or shared with, another thread.
T: Send means a T can be moved to another thread; T: Sync means &T can be shared between threads. They are implemented automatically when all fields qualify; Rc is neither, Arc<Mutex
Loading interactive…
Examples
Moving an
Rc<i32>intothread::spawnfails with E0277 (Rc<i32>cannot be sent between threads safely); the same code withArc<i32>compiles.
See also