Expand description
A module containing easier to use thread-safe types for the creation of larger thread safe systems.
§Included Types
SyncCell- A replacement forstd::cell::RefCellandstd::cell::Cellwith an easier to use API thanstd::sync::RwLock.HeldSyncCell- A cell that maintains a previous value until theupdatemethod is called at which point any changes to the value are applied.
Structs§
- Held
Sync Cell - A cell that holds a value until any changes made are applied by use of the
updatemethod. Getting the value or obtaining a reference to the value in this cell will return the value immediately following the last call toupdate. This allows for mutably altering a value while keeping a reference for a short amount of time to the old value. This is useful when you want a method in a structure to be able to modify the structure it is being called from such as when changing the scene in a game engine. - Sync
Cell - A mutable memory location that can be modified safely from multiple threads.
This structure is similar to
std::cell::Cellorstd::cell::RefCellwhile being thread-safe. It functions as a thin wrapper aroundstd::sync::RwLockwhile assuming that poisoned locks indicate an unrecoverable error. This makes it more ergonomic to use thanRwLockat the cost of some stability.