pub struct UsingQueue<T> { /* private fields */ }
Expand description

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

Implementations

Create a new struct with a maximum size of max_size.

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.

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().

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

Is there anything in the queue currently?

Clears everything; the queue is entirely reset.

Fork-function for take_used_if and clone_used_if.

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.