Struct algorithms_rs::queue::Queue

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

Queue data structure

Implementations

Create an empty queue of fixed size

use algorithms_rs::Queue;

let empty_queue = Queue::<i32>::new(1);

assert_eq!(empty_queue.is_empty(), true);

Determine if queue is empty

use algorithms_rs::Queue;

let empty_queue = Queue::<i32>::new(1);

assert_eq!(empty_queue.is_empty(), true);

Enter the queue from the end of the queue

use algorithms_rs::Queue;

let mut queue = Queue::<i32>::new(3);

queue.en_queue(1);
queue.en_queue(2);

assert_eq!(queue.is_empty(), false);

From the head of the queue Out of the queue

use algorithms_rs::Queue;

let mut queue = Queue::<i32>::new(3);

queue.en_queue(1);
queue.en_queue(2);

queue.de_queue();
queue.de_queue();

assert_eq!(queue.is_empty(), true);

Trait Implementations

Formats the value using the given formatter. Read more

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.

Should always be Self
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.