Struct using_queue::UsingQueue[][src]

pub struct UsingQueue<T> { /* fields omitted */ }

Special queue-like data structure that includes the notion of usage to avoid items that were queued but never used from making it into the queue.

Implementations

impl<T> UsingQueue<T>[src]

pub fn new(max_size: usize) -> UsingQueue<T>[src]

Create a new struct with a maximum size of max_size.

pub fn peek_last_ref(&self) -> Option<&T>[src]

Return a reference to the item at the top of the queue (or None if the queue is empty); it doesn’t constitute noting that the item is used.

pub fn use_last_ref(&mut self) -> Option<&T>[src]

Return a reference to the item at the top of the queue (or None if the queue is empty); this constitutes using the item and will remain in the queue for at least another max_size invocations of set_pending() + use_last_ref().

pub fn set_pending(&mut self, b: T)[src]

Place an item on the end of the queue. The previously pending item will be removed if use_last_ref() since it was set.

pub fn is_in_use(&self) -> bool[src]

Is there anything in the queue currently?

pub fn reset(&mut self)[src]

Clears everything; the queue is entirely reset.

pub fn get_used_if<P>(&mut self, action: GetAction, predicate: P) -> Option<T> where
    P: Fn(&T) -> bool,
    T: Clone
[src]

Fork-function for take_used_if and clone_used_if.

pub fn get_pending_if<P>(&mut self, predicate: P) -> Option<T> where
    P: Fn(&T) -> bool,
    T: Clone
[src]

Returns a clone of the pending block if f returns true with a reference to it as a parameter, otherwise None.

If pending block is not available will clone the first of the used blocks that match the predicate.

Auto Trait Implementations

impl<T> RefUnwindSafe for UsingQueue<T> where
    T: RefUnwindSafe

impl<T> Send for UsingQueue<T> where
    T: Send

impl<T> Sync for UsingQueue<T> where
    T: Sync

impl<T> Unpin for UsingQueue<T> where
    T: Unpin

impl<T> UnwindSafe for UsingQueue<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.