[][src]Struct arraydeque::ArrayDeque

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]

pub fn push_front(
    &mut self,
    element: A::Item
) -> Result<(), CapacityError<A::Item>>
[src]

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]

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]

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]

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]

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]

pub fn push_front(&mut self, element: A::Item) -> Option<A::Item>[src]

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]

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]

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]

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]

pub fn new() -> ArrayDeque<A, B>[src]

Creates an empty ArrayDeque.

Examples

use arraydeque::ArrayDeque;

let buf: ArrayDeque<[usize; 2]> = ArrayDeque::new();

pub fn capacity(&self) -> usize[src]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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, B: Behavior> Into<Vec<<A as Array>::Item>> for ArrayDeque<A, B> where
    Self: FromIterator<A::Item>, 
[src]

impl<A: Array> Extend<<A as Array>::Item> for ArrayDeque<A, Saturating>[src]

impl<A: Array> Extend<<A as Array>::Item> for ArrayDeque<A, Wrapping>[src]

impl<A: Array, B: Behavior> Drop for ArrayDeque<A, B>[src]

impl<A: Array, B: Behavior> PartialOrd<ArrayDeque<A, B>> for ArrayDeque<A, B> where
    A::Item: PartialOrd
[src]

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

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> PartialEq<ArrayDeque<A, B>> for ArrayDeque<A, B> where
    A::Item: PartialEq
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<A: Array, B: Behavior> IntoIterator for ArrayDeque<A, B>[src]

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?

impl<'a, A: Array, B: Behavior> IntoIterator for &'a ArrayDeque<A, B>[src]

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?

impl<'a, A: Array, B: Behavior> IntoIterator for &'a mut ArrayDeque<A, B>[src]

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?

impl<A: Array, B: Behavior> Default for ArrayDeque<A, B>[src]

impl<A: Array> From<ArrayDeque<A, Wrapping>> for ArrayDeque<A, Saturating>[src]

impl<A: Array> From<ArrayDeque<A, Saturating>> for ArrayDeque<A, Wrapping>[src]

impl<A: Array, B: Behavior> From<Vec<<A as Array>::Item>> for ArrayDeque<A, B> where
    Self: FromIterator<A::Item>, 
[src]

impl<A: Array> Clone for ArrayDeque<A, Saturating> where
    A::Item: Clone
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<A: Array> Clone for ArrayDeque<A, Wrapping> where
    A::Item: Clone
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<A: Array, B: Behavior> Ord for ArrayDeque<A, B> where
    A::Item: Ord
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more

impl<A: Array, B: Behavior> Eq for ArrayDeque<A, B> where
    A::Item: Eq
[src]

impl<A: Array, B: Behavior> Debug for ArrayDeque<A, B> where
    A::Item: Debug
[src]

impl<A: Array, B: Behavior> Hash for ArrayDeque<A, B> where
    A::Item: Hash
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<A: Array, B: Behavior> Index<usize> for ArrayDeque<A, B>[src]

type Output = A::Item

The returned type after indexing.

impl<A: Array, B: Behavior> IndexMut<usize> for ArrayDeque<A, B>[src]

impl<A: Array> FromIterator<<A as Array>::Item> for ArrayDeque<A, Saturating>[src]

impl<A: Array> FromIterator<<A as Array>::Item> for ArrayDeque<A, Wrapping>[src]

Auto Trait Implementations

impl<A, B> Send for ArrayDeque<A, B> where
    A: Send,
    B: Send,
    <A as Array>::Index: Send

impl<A, B> Sync for ArrayDeque<A, B> where
    A: Sync,
    B: Sync,
    <A as Array>::Index: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.