Crate voluntary_servitude
source ·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)
Call this code from C (FFI)
(also in ./examples)System Allocator ("system-alloc" feature)
Logging ("logs" feature)
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 to T you must use FillOnceAtomicOption
and accept the API limitations
A safe AtomicArc
is impossible without a GC, so you must use ArcCell
from crossbeam (locks to clone) or FillOnceAtomicArc
Thread-safe appendable list that can create a lock-free iterator
VoluntaryServitude
(also calledVS
)
Api of VS
Iterator
Modules
Voluntary Servitude Foreign Function Interface (FFI)
Macros
Creates new
VS
with specified elements as in the vec!
macroAlias for
voluntary_servitude
macroStructs
Atomic abstractions of a
Box<T>
Atomic abstraction of a
Option<Box<T>>
Atomic abstractions of a
Option<Arc<T>>
that can provide access to a cloned Option<Arc<T>>
and a Option<&T>
Atomic abstraction of a
Option<Box<T>>
that can provide access to a Option<&T>
Appendable list with lock-free iterator (also called
VS
)Statics
GLOBAL_ALLOC
system-alloc
Represents the use of the system’s allocator instead of rust’s default
Functions
setup_logger
logs
Setup logger according to
RUST_LOG
env varType Definitions
VoluntaryServitude
’s alias