rok::core::collections::deque
rok::core::collections::deque - Deque<T>, a growable ring buffer
with O(1) push and pop at both ends. meta holds [head, len, cap];
a vacated slot is overwritten with a zeroed T so the deque does not
keep a popped value alive.
Structs
Deque
pub struct Deque<T>pub const fn new() -> Deque<T>pub const fn with_capacity(cap: usize) -> Deque<T>pub const fn len(self) -> usizepub fn is_empty(self) -> boolpub fn capacity(self) -> usizepub const fn push_back(self, x: T)pub const fn push_front(self, x: T)pub const fn pop_front(self) -> T | nonepub const fn pop_back(self) -> T | nonepub const fn get(self, i: usize) -> T | noneElement
ifrom the front, ornoneout of bounds.pub const fn set(self, i: usize, x: T) throws (IndexError)Overwrite element
ifrom the front; throws out of bounds.pub fn front(self) -> T | nonepub fn back(self) -> T | nonepub fn clear(self)pub const fn iter(self) -> DequeIter<T>
Trait implementations 7
impl<T> !Sync for Deque<T>impl<T> IntoIterator for Deque<T>impl<T> Default for Deque<T>impl<T> Index<usize> for Deque<T>impl<T> IndexSet<usize> for Deque<T>impl<T: Debug> Debug for Deque<T>impl<T> Transfer for Deque<T>
DequeIter
pub struct DequeIter<T>Front to back.
Trait implementations 1
impl<T> Iterator for DequeIter<T>