The official docs not said.
channel in std::sync::mpsc - Rust (rust-lang.org)
Sender in std::sync::mpsc - Rust (rust-lang.org)
The official docs not said.
channel in std::sync::mpsc - Rust (rust-lang.org)
Sender in std::sync::mpsc - Rust (rust-lang.org)
You can generally rely on Send
and Sync
being either implemented or not to be the marker of different kinds of thread-safety, unless documentation states otherwise. Sender
is both Send
and Sync
, so unless standard library has a soundness bug, Sender
must be thread-safe.
Implementing Send
indicates that it's safe to pass this type between threads (but says nothing about having access to it from two threads at once).
Implementing Sync
says that it's safe to have access to this type from two threads simultaneously.
Unless there's a bug in the implementation (in which case, report an issue to get it fixed), you can assume that a type that has implementations of both Send
and Sync
is thread-safe.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.