Struct arraydeque::ArrayDeque [−][src]
pub struct ArrayDeque<A: Array, B: Behavior = Saturating> { /* fields omitted */ }
A fixed capacity ring buffer.
It can be stored directly on the stack if needed.
The "default" usage of this type as a queue is to use push_back
to add to
the queue, and pop_front
to remove from the queue. Iterating over ArrayDeque
goes front
to back.
Methods
impl<A: Array> ArrayDeque<A, Saturating>
[src]
impl<A: Array> ArrayDeque<A, Saturating>
pub fn push_front(
&mut self,
element: A::Item
) -> Result<(), CapacityError<A::Item>>
[src]
pub fn push_front(
&mut self,
element: A::Item
) -> Result<(), CapacityError<A::Item>>
Add an element to the front of the deque.
Return Ok(())
if the push succeeds, or return Err(CapacityError { *element* })
if the vector is full.
Examples
// 1 -(+)-> [_, _, _] => [1, _, _] -> Ok(()) // 2 -(+)-> [1, _, _] => [2, 1, _] -> Ok(()) // 3 -(+)-> [2, 1, _] => [3, 2, 1] -> Ok(()) // 4 -(+)-> [3, 2, 1] => [3, 2, 1] -> Err(CapacityError { element: 4 }) use arraydeque::{ArrayDeque, CapacityError}; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.push_front(1); buf.push_front(2); buf.push_front(3); let overflow = buf.push_front(4); assert_eq!(overflow, Err(CapacityError { element: 4 })); assert_eq!(buf.back(), Some(&1));
pub fn push_back(
&mut self,
element: A::Item
) -> Result<(), CapacityError<A::Item>>
[src]
pub fn push_back(
&mut self,
element: A::Item
) -> Result<(), CapacityError<A::Item>>
Add an element to the back of the deque.
Return Ok(())
if the push succeeds, or return Err(CapacityError { *element* })
if the vector is full.
Examples
// [_, _, _] <-(+)- 1 => [_, _, 1] -> Ok(()) // [_, _, 1] <-(+)- 2 => [_, 1, 2] -> Ok(()) // [_, 1, 2] <-(+)- 3 => [1, 2, 3] -> Ok(()) // [1, 2, 3] <-(+)- 4 => [1, 2, 3] -> Err(CapacityError { element: 4 }) use arraydeque::{ArrayDeque, CapacityError}; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.push_back(1); buf.push_back(2); buf.push_back(3); let overflow = buf.push_back(4); assert_eq!(overflow, Err(CapacityError { element: 4 })); assert_eq!(buf.back(), Some(&3));
pub fn insert(
&mut self,
index: usize,
element: A::Item
) -> Result<(), CapacityError<A::Item>>
[src]
pub fn insert(
&mut self,
index: usize,
element: A::Item
) -> Result<(), CapacityError<A::Item>>
Inserts an element at index
within the ArrayDeque
. Whichever
end is closer to the insertion point will be moved to make room,
and all the affected elements will be moved to new positions.
Return Ok(())
if the push succeeds, or return Err(CapacityError { *element* })
if the vector is full.
Element at index 0 is the front of the queue.
Panics
Panics if index
is greater than ArrayDeque
's length
Examples
// [_, _, _] <-(#0)- 3 => [3, _, _] -> Ok(()) // [3, _, _] <-(#0)- 1 => [1, 3, _] -> Ok(()) // [1, 3, _] <-(#1)- 2 => [1, 2, 3] -> Ok(()) // [1, 2, 3] <-(#1)- 4 => [1, 2, 3] -> Err(CapacityError { element: 4 }) use arraydeque::{ArrayDeque, CapacityError}; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.insert(0, 3); buf.insert(0, 1); buf.insert(1, 2); let overflow = buf.insert(1, 4); assert_eq!(overflow, Err(CapacityError { element: 4 })); assert_eq!(buf.back(), Some(&3));
pub fn extend_front<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
[src]
pub fn extend_front<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
Extend deque from front with the contents of an iterator.
Does not extract more items than there is space for. No error occurs if there are more iterator elements.
Examples
// [9, 8, 7] -(+)-> [_, _, _, _, _, _, _] => [7, 8, 9, _, _, _, _] // [6, 5, 4] -(+)-> [7, 8, 9, _, _, _, _] => [4, 5, 6, 7, 8, 9, _] // [3, 2, 1] -(+)-> [4, 5, 6, 7, 8, 9, _] => [3, 4, 5, 6, 7, 8, 9] use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 7]> = ArrayDeque::new(); buf.extend_front(vec![9, 8, 7].into_iter()); buf.extend_front(vec![6, 5, 4].into_iter()); assert_eq!(buf.len(), 6); // max capacity reached buf.extend_front(vec![3, 2, 1].into_iter()); assert_eq!(buf.len(), 7); assert_eq!(buf, vec![3, 4, 5, 6, 7, 8, 9].into());
pub fn extend_back<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
[src]
pub fn extend_back<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
Extend deque from back with the contents of an iterator.
Does not extract more items than there is space for. No error occurs if there are more iterator elements.
Examples
// [_, _, _, _, _, _, _] <-(+)- [1, 2, 3] => [_, _, _, _, 1, 2, 3] // [_, _, _, _, 1, 2, 3] <-(+)- [4, 5, 6] => [_, 1, 2, 3, 4, 5, 6] // [_, 1, 2, 3, 4, 5, 6] <-(+)- [7, 8, 9] => [1, 2, 3, 4, 5, 6, 7] use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 7]> = ArrayDeque::new(); buf.extend_back(vec![1, 2, 3].into_iter()); buf.extend_back(vec![4, 5, 6].into_iter()); assert_eq!(buf.len(), 6); // max capacity reached buf.extend_back(vec![7, 8, 9].into_iter()); assert_eq!(buf.len(), 7); assert_eq!(buf, vec![1, 2, 3, 4, 5, 6, 7].into());
impl<A: Array> ArrayDeque<A, Wrapping>
[src]
impl<A: Array> ArrayDeque<A, Wrapping>
pub fn push_front(&mut self, element: A::Item) -> Option<A::Item>
[src]
pub fn push_front(&mut self, element: A::Item) -> Option<A::Item>
Add an element to the front of the deque.
Return None
if deque still has capacity, or Some(existing)
if the deque is full, where existing
is the backmost element being kicked out.
Examples
// 1 -(+)-> [_, _, _] => [1, _, _] -> None // 2 -(+)-> [1, _, _] => [2, 1, _] -> None // 3 -(+)-> [2, 1, _] => [3, 2, 1] -> None // 4 -(+)-> [3, 2, 1] => [4, 3, 2] -> Some(1) use arraydeque::{ArrayDeque, Wrapping}; let mut buf: ArrayDeque<[_; 3], Wrapping> = ArrayDeque::new(); buf.push_front(1); buf.push_front(2); buf.push_front(3); let existing = buf.push_front(4); assert_eq!(existing, Some(1)); assert_eq!(buf.back(), Some(&2));
pub fn push_back(&mut self, element: A::Item) -> Option<A::Item>
[src]
pub fn push_back(&mut self, element: A::Item) -> Option<A::Item>
Appends an element to the back of a buffer
Return None
if deque still has capacity, or Some(existing)
if the deque is full, where existing
is the frontmost element being kicked out.
Examples
// [_, _, _] <-(+)- 1 => [_, _, 1] -> None // [_, _, 1] <-(+)- 2 => [_, 1, 2] -> None // [_, 1, 2] <-(+)- 3 => [1, 2, 3] -> None // [1, 2, 3] <-(+)- 4 => [2, 3, 4] -> Some(1) use arraydeque::{ArrayDeque, Wrapping}; let mut buf: ArrayDeque<[_; 3], Wrapping> = ArrayDeque::new(); buf.push_back(1); buf.push_back(2); buf.push_back(3); let existing = buf.push_back(4); assert_eq!(existing, Some(1)); assert_eq!(buf.back(), Some(&4));
pub fn extend_front<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
[src]
pub fn extend_front<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
Extend deque from front with the contents of an iterator.
Extracts all items from iterator and kicks out the backmost element if necessary.
Examples
// [9, 8, 7] -(+)-> [_, _, _, _, _, _, _] => [7, 8, 9, _, _, _, _] // [6, 5, 4] -(+)-> [7, 8, 9, _, _, _, _] => [4, 5, 6, 7, 8, 9, _] // [3, 2, 1] -(+)-> [4, 5, 6, 7, 8, 9, _] => [1, 2, 3, 4, 5, 6, 7] use arraydeque::{ArrayDeque, Wrapping}; let mut buf: ArrayDeque<[_; 7], Wrapping> = ArrayDeque::new(); buf.extend_front(vec![9, 8, 7].into_iter()); buf.extend_front(vec![6, 5, 4].into_iter()); assert_eq!(buf.len(), 6); // max capacity reached buf.extend_front(vec![3, 2, 1].into_iter()); assert_eq!(buf.len(), 7); assert_eq!(buf, vec![1, 2, 3, 4, 5, 6, 7].into());
pub fn extend_back<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
[src]
pub fn extend_back<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
Extend deque from back with the contents of an iterator.
Extracts all items from iterator and kicks out the frontmost element if necessary.
Examples
// [_, _, _, _, _, _, _] <-(+)- [1, 2, 3] => [_, _, _, _, 1, 2, 3] // [_, _, _, _, 1, 2, 3] <-(+)- [4, 5, 6] => [_, 1, 2, 3, 4, 5, 6] // [_, 1, 2, 3, 4, 5, 6] <-(+)- [7, 8, 9] => [3, 4, 5, 6, 7, 8, 9] use arraydeque::{ArrayDeque, Wrapping}; let mut buf: ArrayDeque<[_; 7], Wrapping> = ArrayDeque::new(); buf.extend_back(vec![1, 2, 3].into_iter()); buf.extend_back(vec![4, 5, 6].into_iter()); assert_eq!(buf.len(), 6); // max capacity reached buf.extend_back(vec![7, 8, 9].into_iter()); assert_eq!(buf.len(), 7); assert_eq!(buf, vec![3, 4, 5, 6, 7, 8, 9].into());
impl<A: Array, B: Behavior> ArrayDeque<A, B>
[src]
impl<A: Array, B: Behavior> ArrayDeque<A, B>
pub fn new() -> ArrayDeque<A, B>
[src]
pub fn new() -> ArrayDeque<A, B>
Creates an empty ArrayDeque
.
Examples
use arraydeque::ArrayDeque; let buf: ArrayDeque<[usize; 2]> = ArrayDeque::new();
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
Return the capacity of the ArrayDeque
.
Examples
use arraydeque::ArrayDeque; let buf: ArrayDeque<[usize; 2]> = ArrayDeque::new(); assert_eq!(buf.capacity(), 2);
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of elements in the ArrayDeque
.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 1]> = ArrayDeque::new(); assert_eq!(buf.len(), 0); buf.push_back(1); assert_eq!(buf.len(), 1);
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true if the buffer contains no elements
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 1]> = ArrayDeque::new(); assert!(buf.is_empty()); buf.push_back(1); assert!(!buf.is_empty());
pub fn is_full(&self) -> bool
[src]
pub fn is_full(&self) -> bool
Returns true if the buffer is full.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 1]> = ArrayDeque::new(); assert!(!buf.is_full()); buf.push_back(1); assert!(buf.is_full());
pub fn contains(&self, x: &A::Item) -> bool where
A::Item: PartialEq<A::Item>,
[src]
pub fn contains(&self, x: &A::Item) -> bool where
A::Item: PartialEq<A::Item>,
Returns true
if the ArrayDeque
contains an element equal to the
given value.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 2]> = ArrayDeque::new(); buf.push_back(1); buf.push_back(2); assert_eq!(buf.contains(&1), true); assert_eq!(buf.contains(&3), false);
pub fn front(&self) -> Option<&A::Item>
[src]
pub fn front(&self) -> Option<&A::Item>
Provides a reference to the front element, or None
if the sequence is
empty.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 2]> = ArrayDeque::new(); assert_eq!(buf.front(), None); buf.push_back(1); buf.push_back(2); assert_eq!(buf.front(), Some(&1));
pub fn front_mut(&mut self) -> Option<&mut A::Item>
[src]
pub fn front_mut(&mut self) -> Option<&mut A::Item>
Provides a mutable reference to the front element, or None
if the
sequence is empty.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 2]> = ArrayDeque::new(); assert_eq!(buf.front_mut(), None); buf.push_back(1); buf.push_back(2); assert_eq!(buf.front_mut(), Some(&mut 1));
pub fn back(&self) -> Option<&A::Item>
[src]
pub fn back(&self) -> Option<&A::Item>
Provides a reference to the back element, or None
if the sequence is
empty.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 2]> = ArrayDeque::new(); buf.push_back(1); buf.push_back(2); assert_eq!(buf.back(), Some(&2));
pub fn back_mut(&mut self) -> Option<&mut A::Item>
[src]
pub fn back_mut(&mut self) -> Option<&mut A::Item>
Provides a mutable reference to the back element, or None
if the
sequence is empty.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 2]> = ArrayDeque::new(); buf.push_back(1); buf.push_back(2); assert_eq!(buf.back_mut(), Some(&mut 2));
pub fn get(&self, index: usize) -> Option<&A::Item>
[src]
pub fn get(&self, index: usize) -> Option<&A::Item>
Retrieves an element in the ArrayDeque
by index.
Element at index 0 is the front of the queue.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); buf.push_back(2); assert_eq!(buf.get(1), Some(&1));
pub fn get_mut(&mut self, index: usize) -> Option<&mut A::Item>
[src]
pub fn get_mut(&mut self, index: usize) -> Option<&mut A::Item>
Retrieves an element in the ArrayDeque
mutably by index.
Element at index 0 is the front of the queue.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); buf.push_back(2); assert_eq!(buf.get_mut(1), Some(&mut 1));
ⓘImportant traits for Iter<'a, T>pub fn iter(&self) -> Iter<A::Item>
[src]
pub fn iter(&self) -> Iter<A::Item>
Returns a front-to-back iterator.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); buf.push_back(2); let expected = vec![0, 1, 2]; assert!(buf.iter().eq(expected.iter()));
ⓘImportant traits for IterMut<'a, T>pub fn iter_mut(&mut self) -> IterMut<A::Item>
[src]
pub fn iter_mut(&mut self) -> IterMut<A::Item>
Returns a front-to-back iterator that returns mutable references.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[usize; 3]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); buf.push_back(2); let mut expected = vec![0, 1, 2]; assert!(buf.iter_mut().eq(expected.iter_mut()));
pub fn pop_front(&mut self) -> Option<A::Item>
[src]
pub fn pop_front(&mut self) -> Option<A::Item>
Removes the first element and returns it, or None
if the sequence is
empty.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 2]> = ArrayDeque::new(); buf.push_back(1); buf.push_back(2); assert_eq!(buf.pop_front(), Some(1)); assert_eq!(buf.pop_front(), Some(2)); assert_eq!(buf.pop_front(), None);
pub fn pop_back(&mut self) -> Option<A::Item>
[src]
pub fn pop_back(&mut self) -> Option<A::Item>
Removes the last element from a buffer and returns it, or None
if
it is empty.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 2]> = ArrayDeque::new(); assert_eq!(buf.pop_back(), None); buf.push_back(1); buf.push_back(2); assert_eq!(buf.pop_back(), Some(2)); assert_eq!(buf.pop_back(), Some(1));
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Clears the buffer, removing all values.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 1]> = ArrayDeque::new(); buf.push_back(1); buf.clear(); assert!(buf.is_empty());
ⓘImportant traits for Drain<'a, A, B>pub fn drain<R>(&mut self, range: R) -> Drain<A, B> where
R: RangeArgument<usize>,
[src]
pub fn drain<R>(&mut self, range: R) -> Drain<A, B> where
R: RangeArgument<usize>,
Create a draining iterator that removes the specified range in the
ArrayDeque
and yields the removed items.
Note 1: The element range is removed even if the iterator is not consumed until the end.
Note 2: It is unspecified how many elements are removed from the deque,
if the Drain
value is not dropped, but the borrow it holds expires
(eg. due to mem::forget).
Panics
Panics if the starting point is greater than the end point or if the end point is greater than the length of the deque.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); buf.push_back(2); { let drain = buf.drain(2..); assert!(vec![2].into_iter().eq(drain)); } { let iter = buf.iter(); assert!(vec![0, 1].iter().eq(iter)); } // A full range clears all contents buf.drain(..); assert!(buf.is_empty());
pub fn swap(&mut self, i: usize, j: usize)
[src]
pub fn swap(&mut self, i: usize, j: usize)
Swaps elements at indices i
and j
.
i
and j
may be equal.
Fails if there is no element with either index.
Element at index 0 is the front of the queue.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); buf.push_back(2); buf.swap(0, 2); assert_eq!(buf, vec![2, 1, 0].into());
pub fn swap_remove_back(&mut self, index: usize) -> Option<A::Item>
[src]
pub fn swap_remove_back(&mut self, index: usize) -> Option<A::Item>
Removes an element from anywhere in the ArrayDeque
and returns it, replacing it with the
last element.
This does not preserve ordering, but is O(1).
Returns None
if index
is out of bounds.
Element at index 0 is the front of the queue.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); assert_eq!(buf.swap_remove_back(0), None); buf.push_back(0); buf.push_back(1); buf.push_back(2); assert_eq!(buf.swap_remove_back(0), Some(0)); assert_eq!(buf, vec![2, 1].into());
pub fn swap_remove_front(&mut self, index: usize) -> Option<A::Item>
[src]
pub fn swap_remove_front(&mut self, index: usize) -> Option<A::Item>
Removes an element from anywhere in the ArrayDeque
and returns it,
replacing it with the first element.
This does not preserve ordering, but is O(1).
Returns None
if index
is out of bounds.
Element at index 0 is the front of the queue.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); assert_eq!(buf.swap_remove_back(0), None); buf.push_back(0); buf.push_back(1); buf.push_back(2); assert_eq!(buf.swap_remove_front(2), Some(2)); assert_eq!(buf, vec![1, 0].into());
pub fn remove(&mut self, index: usize) -> Option<A::Item>
[src]
pub fn remove(&mut self, index: usize) -> Option<A::Item>
Removes and returns the element at index
from the ArrayDeque
.
Whichever end is closer to the removal point will be moved to make
room, and all the affected elements will be moved to new positions.
Returns None
if index
is out of bounds.
Element at index 0 is the front of the queue.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); buf.push_back(2); assert_eq!(buf.remove(1), Some(1)); assert_eq!(buf, vec![0, 2].into());
pub fn split_off(&mut self, at: usize) -> Self
[src]
pub fn split_off(&mut self, at: usize) -> Self
Splits the collection into two at the given index.
Returns a newly allocated Self
. self
contains elements [0, at)
,
and the returned Self
contains elements [at, len)
.
Element at index 0 is the front of the queue.
Panics
Panics if at > len
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 3]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); buf.push_back(2); // buf = [0], buf2 = [1, 2] let buf2 = buf.split_off(1); assert_eq!(buf.len(), 1); assert_eq!(buf2.len(), 2);
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&A::Item) -> bool,
[src]
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&A::Item) -> bool,
Retains only the elements specified by the predicate.
In other words, remove all elements e
such that f(&e)
returns false.
This method operates in place and preserves the order of the retained
elements.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 4]> = ArrayDeque::new(); buf.extend_back(0..4); buf.retain(|&x| x % 2 == 0); assert_eq!(buf, vec![0, 2].into());
pub fn as_slices(&self) -> (&[A::Item], &[A::Item])
[src]
pub fn as_slices(&self) -> (&[A::Item], &[A::Item])
Returns a pair of slices which contain, in order, the contents of the
ArrayDeque
.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 7]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); assert_eq!(buf.as_slices(), (&[0, 1][..], &[][..])); buf.push_front(2); assert_eq!(buf.as_slices(), (&[2][..], &[0, 1][..]));
pub fn as_mut_slices(&mut self) -> (&mut [A::Item], &mut [A::Item])
[src]
pub fn as_mut_slices(&mut self) -> (&mut [A::Item], &mut [A::Item])
Returns a pair of slices which contain, in order, the contents of the
ArrayDeque
.
Examples
use arraydeque::ArrayDeque; let mut buf: ArrayDeque<[_; 7]> = ArrayDeque::new(); buf.push_back(0); buf.push_back(1); assert_eq!(buf.as_mut_slices(), (&mut [0, 1][..], &mut[][..])); buf.push_front(2); assert_eq!(buf.as_mut_slices(), (&mut[2][..], &mut[0, 1][..]));
Trait Implementations
impl<A: Array> Extend<A::Item> for ArrayDeque<A, Saturating>
[src]
impl<A: Array> Extend<A::Item> for ArrayDeque<A, Saturating>
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
[src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
Extends a collection with the contents of an iterator. Read more
impl<A: Array> FromIterator<A::Item> for ArrayDeque<A, Saturating>
[src]
impl<A: Array> FromIterator<A::Item> for ArrayDeque<A, Saturating>
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = A::Item>,
[src]
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = A::Item>,
Creates a value from an iterator. Read more
impl<A: Array> Clone for ArrayDeque<A, Saturating> where
A::Item: Clone,
[src]
impl<A: Array> Clone for ArrayDeque<A, Saturating> where
A::Item: Clone,
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<A: Array> Extend<A::Item> for ArrayDeque<A, Wrapping>
[src]
impl<A: Array> Extend<A::Item> for ArrayDeque<A, Wrapping>
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
[src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = A::Item>,
Extends a collection with the contents of an iterator. Read more
impl<A: Array> FromIterator<A::Item> for ArrayDeque<A, Wrapping>
[src]
impl<A: Array> FromIterator<A::Item> for ArrayDeque<A, Wrapping>
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = A::Item>,
[src]
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = A::Item>,
Creates a value from an iterator. Read more
impl<A: Array> Clone for ArrayDeque<A, Wrapping> where
A::Item: Clone,
[src]
impl<A: Array> Clone for ArrayDeque<A, Wrapping> where
A::Item: Clone,
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<A: Array> From<ArrayDeque<A, Wrapping>> for ArrayDeque<A, Saturating>
[src]
impl<A: Array> From<ArrayDeque<A, Wrapping>> for ArrayDeque<A, Saturating>
fn from(buf: ArrayDeque<A, Wrapping>) -> Self
[src]
fn from(buf: ArrayDeque<A, Wrapping>) -> Self
Performs the conversion.
impl<A: Array> From<ArrayDeque<A, Saturating>> for ArrayDeque<A, Wrapping>
[src]
impl<A: Array> From<ArrayDeque<A, Saturating>> for ArrayDeque<A, Wrapping>
fn from(buf: ArrayDeque<A, Saturating>) -> Self
[src]
fn from(buf: ArrayDeque<A, Saturating>) -> Self
Performs the conversion.
impl<A: Array, B: Behavior> From<Vec<A::Item>> for ArrayDeque<A, B> where
Self: FromIterator<A::Item>,
[src]
impl<A: Array, B: Behavior> From<Vec<A::Item>> for ArrayDeque<A, B> where
Self: FromIterator<A::Item>,
impl<A: Array, B: Behavior> Into<Vec<A::Item>> for ArrayDeque<A, B> where
Self: FromIterator<A::Item>,
[src]
impl<A: Array, B: Behavior> Into<Vec<A::Item>> for ArrayDeque<A, B> where
Self: FromIterator<A::Item>,
impl<A: Array, B: Behavior> Drop for ArrayDeque<A, B>
[src]
impl<A: Array, B: Behavior> Drop for ArrayDeque<A, B>
impl<A: Array, B: Behavior> Default for ArrayDeque<A, B>
[src]
impl<A: Array, B: Behavior> Default for ArrayDeque<A, B>
impl<A: Array, B: Behavior> PartialEq for ArrayDeque<A, B> where
A::Item: PartialEq,
[src]
impl<A: Array, B: Behavior> PartialEq for ArrayDeque<A, B> where
A::Item: PartialEq,
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<A: Array, B: Behavior> Eq for ArrayDeque<A, B> where
A::Item: Eq,
[src]
impl<A: Array, B: Behavior> Eq for ArrayDeque<A, B> where
A::Item: Eq,
impl<A: Array, B: Behavior> PartialOrd for ArrayDeque<A, B> where
A::Item: PartialOrd,
[src]
impl<A: Array, B: Behavior> PartialOrd for ArrayDeque<A, B> where
A::Item: PartialOrd,
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<A: Array, B: Behavior> Ord for ArrayDeque<A, B> where
A::Item: Ord,
[src]
impl<A: Array, B: Behavior> Ord for ArrayDeque<A, B> where
A::Item: Ord,
fn cmp(&self, other: &Self) -> Ordering
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<A: Array, B: Behavior> Hash for ArrayDeque<A, B> where
A::Item: Hash,
[src]
impl<A: Array, B: Behavior> Hash for ArrayDeque<A, B> where
A::Item: Hash,
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash<H: Hasher>(&self, state: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<A: Array, B: Behavior> Index<usize> for ArrayDeque<A, B>
[src]
impl<A: Array, B: Behavior> Index<usize> for ArrayDeque<A, B>
type Output = A::Item
The returned type after indexing.
fn index(&self, index: usize) -> &A::Item
[src]
fn index(&self, index: usize) -> &A::Item
Performs the indexing (container[index]
) operation.
impl<A: Array, B: Behavior> IndexMut<usize> for ArrayDeque<A, B>
[src]
impl<A: Array, B: Behavior> IndexMut<usize> for ArrayDeque<A, B>
fn index_mut(&mut self, index: usize) -> &mut A::Item
[src]
fn index_mut(&mut self, index: usize) -> &mut A::Item
Performs the mutable indexing (container[index]
) operation.
impl<A: Array, B: Behavior> IntoIterator for ArrayDeque<A, B>
[src]
impl<A: Array, B: Behavior> IntoIterator for ArrayDeque<A, B>
type Item = A::Item
The type of the elements being iterated over.
type IntoIter = IntoIter<A, B>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, A: Array, B: Behavior> IntoIterator for &'a ArrayDeque<A, B>
[src]
impl<'a, A: Array, B: Behavior> IntoIterator for &'a ArrayDeque<A, B>
type Item = &'a A::Item
The type of the elements being iterated over.
type IntoIter = Iter<'a, A::Item>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, A: Array, B: Behavior> IntoIterator for &'a mut ArrayDeque<A, B>
[src]
impl<'a, A: Array, B: Behavior> IntoIterator for &'a mut ArrayDeque<A, B>
type Item = &'a mut A::Item
The type of the elements being iterated over.
type IntoIter = IterMut<'a, A::Item>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<A: Array, B: Behavior> Debug for ArrayDeque<A, B> where
A::Item: Debug,
[src]
impl<A: Array, B: Behavior> Debug for ArrayDeque<A, B> where
A::Item: Debug,