Trait enso_flexer::prelude::SmallVecOps [−][src]
pub trait SmallVecOps { type Item; fn binary_search_by<F>(&self, f: F) -> Result<usize, usize>
where
F: FnMut(&Self::Item) -> Ordering; fn binary_search(&self, t: &Self::Item) -> Result<usize, usize>
where
Self::Item: Ord; }
Expand description
Adds methods to the SmallVec
type.
Associated Types
Loading content...Required methods
fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where
F: FnMut(&Self::Item) -> Ordering,
[src]
F: FnMut(&Self::Item) -> Ordering,
Expand description
Binary searches this sorted slice with a comparator function.
The comparator function should implement an order consistent
with the sort order of the underlying slice, returning an
order code that indicates whether its argument is Less
,
Equal
or Greater
the desired target.
If the value is found then Result::Ok
is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. If the value is not found then
Result::Err
is returned, containing the index where a matching
element could be inserted while maintaining sorted order.
Implementation Details
Please note that the following implementation is a copy-paste from
[Vec::binary_search_by
].
fn binary_search(&self, t: &Self::Item) -> Result<usize, usize> where
Self::Item: Ord,
[src]
Self::Item: Ord,
Expand description
Binary searches this sorted slice for a given element.
If the value is found then Result::Ok
is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. If the value is not found then
Result::Err
is returned, containing the index where a matching
element could be inserted while maintaining sorted order.
Implementation Details
Please note that the following implementation is a copy-paste from
[Vec::binary_search
].
Implementors
impl<T> SmallVecOps for SmallVec<T> where
T: Array,
[src]
impl<T> SmallVecOps for SmallVec<T> where
T: Array,
[src]type Item = <T as Array>::Item
pub fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where
F: FnMut(&<SmallVec<T> as SmallVecOps>::Item) -> Ordering,
[src]
F: FnMut(&<SmallVec<T> as SmallVecOps>::Item) -> Ordering,
pub fn binary_search(
&self,
t: &<SmallVec<T> as SmallVecOps>::Item
) -> Result<usize, usize> where
<SmallVec<T> as SmallVecOps>::Item: Ord,
[src]
&self,
t: &<SmallVec<T> as SmallVecOps>::Item
) -> Result<usize, usize> where
<SmallVec<T> as SmallVecOps>::Item: Ord,