|
|
|
|
|
by mrtracy
293 days ago
|
|
Rust uses the traits “Send” and “Sync” to encode this information, there is a lot of special tooling in the compiler around these. A type is “Send” if it can be moved from one thread to another, it is “Sync” if it can be simultaneously accessed from multiple threads. These traits are automatically applied whenever the compiler knows it is safe to do so. In cases where automatic application is not possible, the developer can explicitly declare a type to have these traits, but doing so is unsafe (requires the ‘unsafe’ keyword and everything that entails). You can read more at rustinomicon, if you are interested: https://doc.rust-lang.org/nomicon/send-and-sync.html |
|