[−]Trait sized_chunks::ring_buffer::Array
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
fn get(&self, index: usize) -> Option<&Self::Output>
Get a reference to the element at the given index.
fn first(&self) -> Option<&Self::Output>
Get a reference to the first element in the array.
fn last(&self) -> Option<&Self::Output>
Get a reference to the last element in the array.
fn contains(&self, target: &Self::Output) -> bool where
Self::Output: PartialEq<Self::Output>,
Self::Output: PartialEq<Self::Output>,
Return true if an element equivalent to target
exists in the array.
fn binary_search(&self, target: &Self::Output) -> Result<usize, usize> where
Self::Output: Ord,
Self::Output: Ord,
Perform a binary search for target
.
fn binary_search_by<F>(&self, compare: F) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> Ordering,
F: FnMut(&Self::Output) -> Ordering,
Perform a binary search using a comparator function.
fn binary_search_by_key<K, F>(
&self,
key: &K,
extract: F
) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> K,
K: Ord,
&self,
key: &K,
extract: F
) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> K,
K: Ord,
Perform a binary search using a key and a key extractor function.
fn is_sorted(&self) -> bool where
Self::Output: PartialOrd<Self::Output>,
Self::Output: PartialOrd<Self::Output>,
Test whether the array is sorted.
fn is_sorted_by<F>(&self, compare: F) -> bool where
F: FnMut(&Self::Output, &Self::Output) -> Option<Ordering>,
F: FnMut(&Self::Output, &Self::Output) -> Option<Ordering>,
Test whether the array is sorted using a comparator function.
fn is_sorted_by_key<K, F>(&self, extract: F) -> bool where
F: FnMut(&Self::Output) -> K,
K: PartialOrd<K>,
F: FnMut(&Self::Output) -> K,
K: PartialOrd<K>,
Test whether the array is sorted using a key extractor function.
fn starts_with(&self, slice: &[Self::Output]) -> bool where
Self::Output: PartialEq<Self::Output>,
Self::Output: Sized,
Self::Output: PartialEq<Self::Output>,
Self::Output: Sized,
Test whether the array starts with the elements in slice
.
fn ends_with(&self, slice: &[Self::Output]) -> bool where
Self::Output: PartialEq<Self::Output>,
Self::Output: Sized,
Self::Output: PartialEq<Self::Output>,
Self::Output: Sized,
Test whether the array ends with the elements in slice
.
Implementations on Foreign Types
impl<A> Array for VecDeque<A>
fn get(&self, index: usize) -> Option<&<VecDeque<A> as Index<usize>>::Output>
fn contains(&self, target: &<VecDeque<A> as Index<usize>>::Output) -> bool where
<VecDeque<A> as Index<usize>>::Output: PartialEq<<VecDeque<A> as Index<usize>>::Output>,
<VecDeque<A> as Index<usize>>::Output: PartialEq<<VecDeque<A> as Index<usize>>::Output>,
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]
N: ChunkLength<A>,