[][src]Struct sorted_vector_map::map::SortedVectorMap

pub struct SortedVectorMap<K, V>(_);

Implementations

impl<K, V> SortedVectorMap<K, V> where
    K: Ord
[src]

pub fn new() -> SortedVectorMap<K, V>[src]

Creates a new, empty SortedVectorMap.

pub fn with_capacity(capacity: usize) -> SortedVectorMap<K, V>[src]

Creates a new, empty SortedVectorMap, with capacity for capacity entries.

pub fn clear(&mut self)[src]

Clears the map, removing all elements.

pub fn get<Q: ?Sized>(&self, q: &Q) -> Option<&V> where
    K: Borrow<Q>,
    Q: Ord
[src]

Returns a reference to the value corresponding to the key.

pub fn get_key_value<Q: ?Sized>(&self, q: &Q) -> Option<(&K, &V)> where
    K: Borrow<Q>,
    Q: Ord
[src]

Returns the key-value pair corresponding to the key.

pub fn contains_key<Q: ?Sized>(&self, q: &Q) -> bool where
    K: Borrow<Q>,
    Q: Ord
[src]

Returns true if the map contains a value for the specified key.

pub fn get_mut<Q: ?Sized>(&mut self, q: &Q) -> Option<&mut V> where
    K: Borrow<Q>,
    Q: Ord
[src]

Returns a mutable reference to the value corresponding to the key.

pub fn insert(&mut self, k: K, v: V) -> Option<V>[src]

Inserts a key-value pair into the map.

If the map did not have this key present, None is returned.

If the map did have this key present, the value is updated and the old value is returned. They key is not updated, though; this matters for types that can be == without being identical.

If the map did not have the key present, and the key is greater than all of the keys already present, insertion is amortized O(1). Otherwise, insertion is O(n).

pub fn remove<Q: ?Sized>(&mut self, q: &Q) -> Option<V> where
    K: Borrow<Q>,
    Q: Ord
[src]

Removes a key-value pair from the map, returning the value if the key was previously in the map.

pub fn append(&mut self, other: &mut SortedVectorMap<K, V>)[src]

Moves all elements from other into Self, leaving other empty.

pub fn range<Q: ?Sized, R>(&self, range: R) -> Iter<K, V> where
    K: Borrow<Q>,
    Q: Ord,
    R: RangeBounds<Q>, 
[src]

Returns an iterator over the given range of keys.

Panics

Panics if the range start is after the range end.

pub fn range_mut<Q: ?Sized, R>(&mut self, range: R) -> IterMut<K, V> where
    K: Borrow<Q>,
    Q: Ord,
    R: RangeBounds<Q>, 
[src]

Returns a mutable iterator over the given range of keys.

Panics

Panics if the range start is after the range end.

pub fn entry(&mut self, key: K) -> Entry<K, V>[src]

Gets the given key's corresponding entry in the map for in-place manipulation.

pub fn split_off<Q: ?Sized>(&mut self, q: &Q) -> SortedVectorMap<K, V> where
    K: Borrow<Q>,
    Q: Ord
[src]

Splits the collection in two at the given key. Returns everything after the given key, including the key.

pub fn iter(&self) -> Iter<K, V>[src]

Returns an iterator over the pairs of entries in the map.

pub fn iter_mut(&mut self) -> IterMut<K, V>[src]

Returns a mutable iterator over the pairs of entries in the map.

pub fn keys(&self) -> Keys<K, V>[src]

Returns an iterator over the keys of the map, in sorted order.

pub fn values(&self) -> Values<K, V>[src]

Returns an iterator over the values of the map, in order by key.

pub fn values_mut(&mut self) -> ValuesMut<K, V>[src]

Returns a mutable iterator over the values of the map, in order by key.

pub fn len(&self) -> usize[src]

Returns the number of elements in the map.

pub fn is_empty(&self) -> bool[src]

Returns true if the map contains no elements.

Trait Implementations

impl<K, V> Arbitrary for SortedVectorMap<K, V> where
    K: Arbitrary + Ord,
    V: Arbitrary
[src]

impl<K: Clone, V: Clone> Clone for SortedVectorMap<K, V>[src]

impl<K, V> Debug for SortedVectorMap<K, V> where
    K: Ord + Debug,
    V: Debug
[src]

impl<K, V> Default for SortedVectorMap<K, V> where
    K: Ord
[src]

impl<K: Eq, V: Eq> Eq for SortedVectorMap<K, V>[src]

impl<'a, K, V> Extend<(&'a K, &'a V)> for SortedVectorMap<K, V> where
    K: Ord + Copy,
    V: Copy
[src]

impl<K, V> Extend<(K, V)> for SortedVectorMap<K, V> where
    K: Ord
[src]

impl<K, V> FromIterator<(K, V)> for SortedVectorMap<K, V> where
    K: Ord
[src]

impl<K: Hash, V: Hash> Hash for SortedVectorMap<K, V>[src]

impl<'_, K, Q: ?Sized, V> Index<&'_ Q> for SortedVectorMap<K, V> where
    K: Ord + Borrow<Q>,
    Q: Ord
[src]

type Output = V

The returned type after indexing.

fn index(&self, q: &Q) -> &V[src]

Returns a reference to the value corresponding to the supplied key.

Panics

Panics if the key is not present in the SortedVectorMap.

impl<'_, K, Q: ?Sized, V> IndexMut<&'_ Q> for SortedVectorMap<K, V> where
    K: Ord + Borrow<Q>,
    Q: Ord
[src]

fn index_mut(&mut self, q: &Q) -> &mut V[src]

Returns a mutable reference to the value corresponding to the supplied key.

Panics

Panics if the key is not present in the SortedVectorMap.

impl<K, V> IntoIterator for SortedVectorMap<K, V> where
    K: Ord
[src]

type Item = (K, V)

The type of the elements being iterated over.

type IntoIter = IntoIter<(K, V)>

Which kind of iterator are we turning this into?

impl<'a, K: 'a, V: 'a> IntoIterator for &'a SortedVectorMap<K, V> where
    K: Ord
[src]

type Item = (&'a K, &'a V)

The type of the elements being iterated over.

type IntoIter = Iter<'a, K, V>

Which kind of iterator are we turning this into?

impl<'a, K: 'a, V: 'a> IntoIterator for &'a mut SortedVectorMap<K, V> where
    K: Ord
[src]

type Item = (&'a K, &'a mut V)

The type of the elements being iterated over.

type IntoIter = IterMut<'a, K, V>

Which kind of iterator are we turning this into?

impl<K: Ord, V: Ord> Ord for SortedVectorMap<K, V>[src]

impl<K: PartialEq, V: PartialEq> PartialEq<SortedVectorMap<K, V>> for SortedVectorMap<K, V>[src]

impl<K: PartialOrd, V: PartialOrd> PartialOrd<SortedVectorMap<K, V>> for SortedVectorMap<K, V>[src]

impl<K, V> StructuralEq for SortedVectorMap<K, V>[src]

impl<K, V> StructuralPartialEq for SortedVectorMap<K, V>[src]

Auto Trait Implementations

impl<K, V> RefUnwindSafe for SortedVectorMap<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for SortedVectorMap<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for SortedVectorMap<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for SortedVectorMap<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for SortedVectorMap<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,