[−][src]Crate voluntary_servitude
Atomic abstractions and thread-safe appendable list with lock-free iterators
Features
-
Atomic abstractions (Atomic, AtomicOption, FillOnceAtomicOption, FillOnceAtomicArc)
-
Thread-safe appendable list with a lock-free iterator (VoluntaryServitude - also called VS)
-
Serde serialization/deserialization ("serde-traits" feature)
-
par_extend, from_par_iter rayon implementation ("rayon-traits" feature)
-
You probably only need this if you are debugging this crate
Atomic abstractions
Atomic
-> atomicBox<T>
AtomicOption
-> atomicOption<Box<T>>
FillOnceAtomicOption
-> atomicOption<Box<T>>
that can give references (ideal for iterators)FillOnceAtomicArc
-> atomicOption<Arc<T>>
with a limited API (likeFillOnceAtomicOption
)
With Atomic
and AtomicOption
it's not safe to get a reference, you must replace the value to access it.
To safely get a reference of T you must use FillOnceAtomicOption
and accept the API limitations (initially None
but can be filled once).
For a safe AtomicArc
you must use some data-structure from arc-swap
, RwLock/Mutex
from parking_lot
(or std
, which is slower but the standard) or FillOnceAtomicArc
and accept the limited API (2018).
Thread-safe appendable list that can create a lock-free iterator
VoluntaryServitude
(also calledVS
)
API of VS
Iterator
Logging
Setup logger according to RUST_LOG
env var and logs
feature
Enable the feature:
Cargo.toml
[dependencies]
voluntary_servitude = { version = "4", features = "logs" }
Set the RUST_LOG
env var:
export RUST_LOG=voluntary_servitude=trace
export RUST_LOG=voluntary_servitude=debug
export RUST_LOG=voluntary_servitude=info
export RUST_LOG=voluntary_servitude=warn
export RUST_LOG=voluntary_servitude=error
Enable the logger using some setup (like env_logger)
env_logger::init(); // Call code to be logged // ...
Modules
atomics | Atomic abstractions |
Macros
voluntary_servitude | Creates new |
vs | Alias for |
Structs
Iter | Lock-free iterator based on |
NotEmpty | Happens when you call |
VoluntaryServitude | Appendable list with lock-free iterator (also called |
Type Definitions
VS |
|