Expand description
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
with specified elements as in thevec!
macro - vs
- Alias for
voluntary_servitude
macro
Structs§
- Iter
- Lock-free iterator based on
VS
- NotEmpty
- Happens when you call
try_store
in a already filledAtomicOption
/FillOnceAtomicOption
/FillOnceAtomicArc
- Voluntary
Servitude - Appendable list with lock-free iterator (also called
VS
)
Type Aliases§
- VS
VoluntaryServitude
’s alias