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

A queue-like data structure implement through std::vec::Vec.

This is a naive implementation whose insertion time complexity is O(n), which can be improved trivially by using a Deque or SinglyLinkedList.

References:

Implementations

Initialize a queue with empty vector

Adds an element into queue.

Complexity

Constant.

Removes the oldest added element in queue.

Complexity

Linear in the size of the container.

Retrieves the least recently added element without dequeuing.

Complexity

Constant.

Retrieves the size of the queue.

Complexity

Constant.

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.