Queue

Struct Queue 

Source
pub struct Queue<'a, T, P = DefaultConPinnedVec<T>>
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::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>) -> Self

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.