pub struct Sorted<'a, T: 'a, O: 'a> { /* private fields */ }
Expand description
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.
Sortable
: trait.Sortable.html
Implementations§
Source§impl<'a, T, O> Sorted<'a, T, O>
impl<'a, T, O> Sorted<'a, T, O>
pub fn as_inner(&self) -> &T
pub fn deref_inner<U>(&'a self) -> Sorted<'a, &U, O>
pub fn iter(&'a self) -> SortedIter<<&T as IntoIterator>::IntoIter, O> ⓘwhere
&'a T: IntoIterator,
Sourcepub fn from_iter<I>(iter: I) -> Sorted<'a, T, O>where
T: RetainsOrder + FromIterator<<T as Collection>::Item>,
I: IntoIterator<Item = T::Item>,
I::IntoIter: SortedIterator<Ordering = O>,
<I as IntoIterator>::IntoIter: SortedIterator<Ordering = O>,
pub fn from_iter<I>(iter: I) -> Sorted<'a, T, O>where
T: RetainsOrder + FromIterator<<T as Collection>::Item>,
I: IntoIterator<Item = T::Item>,
I::IntoIter: SortedIterator<Ordering = O>,
<I as IntoIterator>::IntoIter: SortedIterator<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 SortedIterator, you’ll safely get a sorted collection.
Sortable
: trait.Sortable.html
Source§impl<'a, T, O> Sorted<'a, T, O>
impl<'a, T, O> Sorted<'a, T, O>
pub fn by_sorting(collection: T) -> Self
Trait Implementations§
Source§impl<'a, T, O> IntoIterator for Sorted<'a, T, O>
impl<'a, T, O> IntoIterator for Sorted<'a, T, O>
Auto Trait Implementations§
impl<'a, T, O> Freeze for Sorted<'a, T, O>where
T: Freeze,
impl<'a, T, O> RefUnwindSafe for Sorted<'a, T, O>where
T: RefUnwindSafe,
O: RefUnwindSafe,
impl<'a, T, O> Send for Sorted<'a, T, O>
impl<'a, T, O> Sync for Sorted<'a, T, O>
impl<'a, T, O> Unpin for Sorted<'a, T, O>where
T: Unpin,
impl<'a, T, O> UnwindSafe for Sorted<'a, T, O>where
T: UnwindSafe,
O: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more