Queue

Struct Queue 

Source
pub struct Queue<'a, T, P = <SplitVec<T> as IntoConcurrentPinnedVec<T>>::ConPinnedVec>
where T: Send, P: ConcurrentPinnedVec<T>,
{ /* private fields */ }
Expand description

A queue of elements that will be returned by the ConcurrentRecursiveIter.

Note that the concurrent recursive iterator is built on top of the ConcurrentQueue. Queue is just a wrapper over the concurrent queue, exposing only two methods:

  • push to add one task at a time,
  • extend to add multiple tasks with known length together with a single update.

Notice that push is very flexible and makes the pushed element available for iteration as fast as possible.

On the other hand, extend minimizes the overhead of concurrency.

Implementationsยง

Sourceยง

impl<T, P> Queue<'_, T, P>
where T: Send, P: ConcurrentPinnedVec<T>,

Source

pub fn push(&self, element: T)

Pushes the element to the iterator, making it available to all threads as fast as possible.

Source

pub fn extend<I>(&self, elements: I)
where I: IntoIterator<Item = T>, <I as IntoIterator>::IntoIter: ExactSizeIterator,

Pushes all elements to the iterator with a single update on the concurrent state.

All of the elements will be available to all threads at the same time, once writing all of them to the queue is completed.

Trait Implementationsยง

Sourceยง

impl<'a, T, P> From<&'a ConcurrentQueue<T, P>> for Queue<'a, T, P>
where T: Send, P: ConcurrentPinnedVec<T>,

Sourceยง

fn from(queue: &'a ConcurrentQueue<T, P>) -> Queue<'a, T, P>

Converts to this type from the input type.

Auto Trait Implementationsยง

ยง

impl<'a, T, P> Freeze for Queue<'a, T, P>

ยง

impl<'a, T, P> RefUnwindSafe for Queue<'a, T, P>

ยง

impl<'a, T, P> Send for Queue<'a, T, P>

ยง

impl<'a, T, P> Sync for Queue<'a, T, P>

ยง

impl<'a, T, P> Unpin for Queue<'a, T, P>

ยง

impl<'a, T, P> UnwindSafe for Queue<'a, T, P>

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> SoM<T> for T

Sourceยง

fn get_ref(&self) -> &T

Returns a reference to self.
Sourceยง

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

Returns a mutable reference to self.
Sourceยง

impl<T> SoR<T> for T

Sourceยง

fn get_ref(&self) -> &T

Returns a reference to self.
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.