Struct sorted::Sorted
[−]
[src]
pub struct Sorted<'a, T: 'a, O: 'a> { /* fields omitted */ }
Guarantees that the inner container is sorted in a specific order.
The Sortable
trait is a requirement for all containers T being wrapped
with Sorted<T>
to enforce certain guarantees for operations that arent
strictly read only (i.e creating iterators). See the documentation of
Sortable
for details.
Methods
impl<'a, T, O> Sorted<'a, T, O>
[src]
fn as_inner(&self) -> &T
fn deref_inner<U: ?Sized>(&'a self) -> Sorted<'a, &U, O> where
U: ,
T: Deref<Target = U>,
U: ,
T: Deref<Target = U>,
fn iter(&'a self) -> SortedIter<<&T as IntoIterator>::IntoIter, O> where
&'a T: IntoIterator,
&'a T: IntoIterator,
fn from_iter<I>(iter: I) -> Sorted<'a, T, O> where
T: RetainsOrder + FromIterator<<T as Collection>::Item>,
I: IntoIterator<Item = T::Item> + IsSorted<Ordering = O>,
<I as IntoIterator>::IntoIter: Iterator + IsSorted<Ordering = O>,
T: RetainsOrder + FromIterator<<T as Collection>::Item>,
I: IntoIterator<Item = T::Item> + IsSorted<Ordering = O>,
<I as IntoIterator>::IntoIter: Iterator + IsSorted<Ordering = O>,
Builds a sorted collection of type T from a sorted iterator.
As the [RetainsOrder
] trait is required to be implemented for T, it's
guaranteed that the order of the input iterator is preserved. Since the
iterator must implement IsSorted, you'll safely get a sorted collection.
impl<'a, T, O> Sorted<'a, T, O> where
T: Sortable,
O: SortOrder<T::Item>,
[src]
T: Sortable,
O: SortOrder<T::Item>,
fn by_sorting(collection: T) -> Self
impl<'a, T, O> Sorted<'a, T, O> where
T: SearchableByOrder<O>,
O: SortOrder<T::Item>,
[src]
T: SearchableByOrder<O>,
O: SortOrder<T::Item>,
impl<'a, T, O> Sorted<'a, T, O> where
T: Sortable + SortedInsert<O>,
O: SortOrder<T::Item>,
[src]
T: Sortable + SortedInsert<O>,
O: SortOrder<T::Item>,
impl<'a, T, O> Sorted<'a, T, O>
[src]
fn as_ref<U: ?Sized>(&self) -> Sorted<'a, &U, O> where
T: AsRef<U>,
U: RetainsOrder,
T: AsRef<U>,
U: RetainsOrder,
Similar to Option::as_ref. It's mapping the inner type with AsRef.
Trait Implementations
impl<'a, T, O> Deref for Sorted<'a, T, O>
[src]
type Target = T
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value
impl<'a, T, O> IsSorted for Sorted<'a, T, O>
[src]
type Ordering = O
impl<'a, T, O> IntoIterator for Sorted<'a, T, O> where
T: IntoIterator<Item = <T as Collection>::Item> + Sortable,
[src]
T: IntoIterator<Item = <T as Collection>::Item> + Sortable,
type Item = <T as Collection>::Item
The type of the elements being iterated over.
type IntoIter = SortedIter<T::IntoIter, O>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more