Trait sized_chunks::ring_buffer::Array[][src]

pub trait Array: HasLength + Index<usize> {
    pub fn get(&self, index: usize) -> Option<&Self::Output> { ... }
pub fn first(&self) -> Option<&Self::Output> { ... }
pub fn last(&self) -> Option<&Self::Output> { ... }
pub fn contains(&self, target: &Self::Output) -> bool
    where
        Self::Output: PartialEq<Self::Output>
, { ... }
pub fn binary_search(&self, target: &Self::Output) -> Result<usize, usize>
    where
        Self::Output: Ord
, { ... }
pub fn binary_search_by<F>(&self, compare: F) -> Result<usize, usize>
    where
        F: FnMut(&Self::Output) -> Ordering
, { ... }
pub fn binary_search_by_key<K, F>(
        &self,
        key: &K,
        extract: F
    ) -> Result<usize, usize>
    where
        K: Ord,
        F: FnMut(&Self::Output) -> K
, { ... }
pub fn is_sorted(&self) -> bool
    where
        Self::Output: PartialOrd<Self::Output>
, { ... }
pub fn is_sorted_by<F>(&self, compare: F) -> bool
    where
        F: FnMut(&Self::Output, &Self::Output) -> Option<Ordering>
, { ... }
pub fn is_sorted_by_key<K, F>(&self, extract: F) -> bool
    where
        K: PartialOrd<K>,
        F: FnMut(&Self::Output) -> K
, { ... }
pub fn starts_with(&self, slice: &[Self::Output]) -> bool
    where
        Self::Output: PartialEq<Self::Output>,
        Self::Output: Sized
, { ... }
pub fn ends_with(&self, slice: &[Self::Output]) -> bool
    where
        Self::Output: PartialEq<Self::Output>,
        Self::Output: Sized
, { ... } }

Trait for data structures which are indexed like arrays.

Types implementing this trait must have populated indexes from 0 up to but not including self.len().

Provided methods

pub fn get(&self, index: usize) -> Option<&Self::Output>[src]

Get a reference to the element at the given index.

pub fn first(&self) -> Option<&Self::Output>[src]

Get a reference to the first element in the array.

pub fn last(&self) -> Option<&Self::Output>[src]

Get a reference to the last element in the array.

pub fn contains(&self, target: &Self::Output) -> bool where
    Self::Output: PartialEq<Self::Output>, 
[src]

Return true if an element equivalent to target exists in the array.

Perform a binary search for target.

pub fn binary_search_by<F>(&self, compare: F) -> Result<usize, usize> where
    F: FnMut(&Self::Output) -> Ordering
[src]

Perform a binary search using a comparator function.

pub fn binary_search_by_key<K, F>(
    &self,
    key: &K,
    extract: F
) -> Result<usize, usize> where
    K: Ord,
    F: FnMut(&Self::Output) -> K, 
[src]

Perform a binary search using a key and a key extractor function.

pub fn is_sorted(&self) -> bool where
    Self::Output: PartialOrd<Self::Output>, 
[src]

Test whether the array is sorted.

pub fn is_sorted_by<F>(&self, compare: F) -> bool where
    F: FnMut(&Self::Output, &Self::Output) -> Option<Ordering>, 
[src]

Test whether the array is sorted using a comparator function.

pub fn is_sorted_by_key<K, F>(&self, extract: F) -> bool where
    K: PartialOrd<K>,
    F: FnMut(&Self::Output) -> K, 
[src]

Test whether the array is sorted using a key extractor function.

pub fn starts_with(&self, slice: &[Self::Output]) -> bool where
    Self::Output: PartialEq<Self::Output>,
    Self::Output: Sized
[src]

Test whether the array starts with the elements in slice.

pub fn ends_with(&self, slice: &[Self::Output]) -> bool where
    Self::Output: PartialEq<Self::Output>,
    Self::Output: Sized
[src]

Test whether the array ends with the elements in slice.

Loading content...

Implementations on Foreign Types

impl<A> Array for VecDeque<A>[src]

Loading content...

Implementors

impl<'a, A: 'a, N: ChunkLength<A> + 'a> Array for Slice<'a, A, N>[src]

#[must_use]fn get(&self, index: usize) -> Option<&A>[src]

Get a reference to the value at a given index.

impl<'a, A: 'a, N: ChunkLength<A> + 'a> Array for SliceMut<'a, A, N>[src]

#[must_use]fn get(&self, index: usize) -> Option<&A>[src]

Get a reference to the value at a given index.

impl<A, N> Array for RingBuffer<A, N> where
    N: ChunkLength<A>, 
[src]

#[must_use]fn get(&self, index: usize) -> Option<&A>[src]

Get a reference to the value at a given index.

Loading content...