Type Definition coca::collections::AllocDeque

source · []
pub type AllocDeque<T, I = usize> = Deque<T, AllocStorage<ArrayLayout<T>>, I>;
This is supported on crate feature alloc only.
Expand description

A deque using a heap-allocated slice for storage.

Note that this still has a fixed capacity, and will never reallocate.

Examples

let mut deque = coca::collections::AllocDeque::<char>::with_capacity(4);
 
deque.push_front('b');
deque.push_front('a');
deque.push_back('c');
deque.push_back('d');
 
assert_eq!(deque, &['a', 'b', 'c', 'd']);
assert_eq!(deque.try_push_back('e'), Err('e'));

Implementations

Creates an empty AllocDeque with the specified capacity.

Panics

Panics if capacity cannot be represented by the a usize.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more