pub struct RcuList<T, F = RcuDefaultFlavor> { /* private fields */ }Expand description
Defines a RCU doubly linked list.
This linked list supports multiple concurrents readers at any time, but only a single writer at a time. The list uses an internal lock for writing operations.
§Limitations
§Mutable References
Because there might always be readers borrowing a node’s data, it is impossible to get a mutable references to the data inside the linked list. You should design the type stored in the list with interior mutabillity that can be shared between threads.
§List Length
Because a writer might concurrently modify the list, the amount of node might change
at any moment. To prevent user error (e.g. allocate an array for each node), there is
no .len() method.
§Safety
It is safe to send an Arc<RcuList<T>> to a non-registered RCU thread. A non-registered
thread may drop an RcuList<T> without calling any RCU primitives since lifetime rules
prevent any other thread from accessing a RCU reference.
Implementations§
Source§impl<T, F> RcuList<T, F>where
F: RcuFlavor,
impl<T, F> RcuList<T, F>where
F: RcuFlavor,
Sourcepub fn contains<G>(&self, x: &T, guard: &G) -> bool
pub fn contains<G>(&self, x: &T, guard: &G) -> bool
Returns true if the list contains an element equal to the given value.
Sourcepub fn push_front(&self, data: T) -> Result<()>
pub fn push_front(&self, data: T) -> Result<()>
Sourcepub fn back<'me, 'guard, G>(&'me self, guard: &'guard G) -> Option<&'guard T>where
G: RcuGuard<Flavor = F>,
'me: 'guard,
pub fn back<'me, 'guard, G>(&'me self, guard: &'guard G) -> Option<&'guard T>where
G: RcuGuard<Flavor = F>,
'me: 'guard,
Provides a reference to the back element, or None if the list is empty.
Sourcepub fn front<'me, 'guard, G>(&'me self, guard: &'guard G) -> Option<&'guard T>where
G: RcuGuard<Flavor = F>,
'me: 'guard,
pub fn front<'me, 'guard, G>(&'me self, guard: &'guard G) -> Option<&'guard T>where
G: RcuGuard<Flavor = F>,
'me: 'guard,
Provides a reference to the front element, or None if the list is empty.