Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Tips and Traps¶
Send
andSync
are 2 thread-safty related marker traits in Rust.A type is
Send
if and only if it can be transferred across thread boundaries. A type isSync
if and only if&T
isSend
.A
MutexGuard
is notSend
but isSync
. ARc
is neitherSend
notSync
. A Cell / RefCell isSend
(if its inner type isSend
) but is neverSync
(no matter what its inner type is).
References¶
Crust of Rust: Send, Sync, and their implementors https://www.youtube.com/watch?v=yOezcP-XaIw
Rustonomicon - Send and Sync https://doc.rust-lang.org/nomicon/send-and-sync.html?highlight=send%20sync#send-and-sync