Trait SortedMap

Source
pub trait SortedMap<Q>: Map
where Q: ?Sized, Self::Key: Borrow<Q>,
{ type RangeIter<'a>: Iterator<Item = (&'a Self::Key, &'a Self::Val)> where Self: 'a; type RangeIterMut<'a>: Iterator<Item = (&'a Self::Key, &'a mut Self::Val)> where Self: 'a; // Required methods fn range<R>(&self, range: R) -> Self::RangeIter<'_> where R: RangeBounds<Q>; fn range_mut<R>(&mut self, range: R) -> Self::RangeIterMut<'_> where R: RangeBounds<Q>; }
Expand description

A map that is sorted by its keys.

Required Associated Types§

Source

type RangeIter<'a>: Iterator<Item = (&'a Self::Key, &'a Self::Val)> where Self: 'a

The type of iterator over the entries of the map within a range of keys.

Source

type RangeIterMut<'a>: Iterator<Item = (&'a Self::Key, &'a mut Self::Val)> where Self: 'a

The type of iterator over the entries of the map within a range of keys, with mutable references to the values.

Required Methods§

Source

fn range<R>(&self, range: R) -> Self::RangeIter<'_>
where R: RangeBounds<Q>,

Returns an iterator over the entries of the map within a range of keys.

Source

fn range_mut<R>(&mut self, range: R) -> Self::RangeIterMut<'_>
where R: RangeBounds<Q>,

Returns an iterator over the entries of the map within a range of keys, with mutable references to the values.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<K, V, Q> SortedMap<Q> for BTreeMap<K, V>
where K: Ord + Borrow<Q>, Q: Ord + ?Sized,

Source§

type RangeIter<'a> = Range<'a, K, V> where Self: 'a

Source§

type RangeIterMut<'a> = RangeMut<'a, K, V> where Self: 'a

Source§

fn range<R>(&self, range: R) -> Self::RangeIter<'_>
where R: RangeBounds<Q>,

Source§

fn range_mut<R>(&mut self, range: R) -> Self::RangeIterMut<'_>
where R: RangeBounds<Q>,

Implementors§