Struct RcuQueue

Source
pub struct RcuQueue<T, F = RcuDefaultFlavor> { /* private fields */ }
Expand description

Defines a RCU wait-free queue.

This queue supports multiple concurrents readers and writers. It is guaranteed to never block on a call.

§Limitations

§References

This queue currently do not offer a way to peek the back or front of the queue. It is also currently not possible to iterate over the queue. Because of this, it is impossible to get any sort of references. The only way to get data is to remove it from the queue with RcuQueue::pop.

§Safety

It is safe to send an Arc<RcuQueue<T>> to a non-registered RCU thread. A non-registered thread may drop an RcuQueue<T> without calling any RCU primitives since lifetime rules prevent any other thread from accessing a RCU reference.

Implementations§

Source§

impl<T, F> RcuQueue<T, F>
where F: RcuFlavor,

Source

pub fn new() -> Arc<Self>

Creates a new RCU queue.

Source

pub fn push<G>(&self, data: T, _guard: &G)
where T: Send, G: RcuGuard<Flavor = F>,

Adds an element to the back of queue.

Source

pub fn pop<G>(&self, _guard: &G) -> Option<Ref<T, F>>
where T: Send, G: RcuGuard<Flavor = F>,

Removes an element to the front of the queue, if any.

Trait Implementations§

Source§

impl<T, F> Drop for RcuQueue<T, F>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T, F> Send for RcuQueue<T, F>
where T: Send, F: RcuFlavor,

§Safety

An RcuQueue can be used to send T to another thread.

Source§

impl<T, F> Sync for RcuQueue<T, F>
where T: Sync, F: RcuFlavor,

§Safety

An RcuQueue can be used to share T between threads.

Auto Trait Implementations§

§

impl<T, F> Freeze for RcuQueue<T, F>

§

impl<T, F> RefUnwindSafe for RcuQueue<T, F>

§

impl<T, F> Unpin for RcuQueue<T, F>

§

impl<T, F> UnwindSafe for RcuQueue<T, F>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.