[][src]Struct vec_collections::VecMap

pub struct VecMap<A: Array>(_);

A map backed by a SmallVec of key value pairs.

Implementations

impl<K, V, A: Array<Item = (K, V)>> VecMap<A>[src]

pub fn map_values<R, B: Array<Item = (K, R)>, F: FnMut(V) -> R>(
    self,
    f: F
) -> VecMap<B>
[src]

map values while keeping keys

impl<A: Array> VecMap<A>[src]

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

pub fn empty() -> Self[src]

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

number of mappings

pub fn retain<F: FnMut(&A::Item) -> bool>(&mut self, f: F)[src]

retain all pairs matching a predicate

pub fn into_inner(self) -> SmallVec<A>[src]

pub fn single(item: A::Item) -> Self[src]

Creates a vecmap with a single item

impl<K: Ord + 'static, V, A: Array<Item = (K, V)>> VecMap<A>[src]

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

pub fn merge_with<B: Array<Item = (K, V)>>(&mut self, rhs: VecMap<B>)[src]

in-place merge with another map of the same type. The merge is right-biased, so on collisions the values from the rhs will win.

pub fn combine_with<B: Array<Item = A::Item>, F: Fn(V, V) -> V>(
    &mut self,
    that: VecMap<B>,
    f: F
)
[src]

in-place combine with another map of the same type. The given function allows to select the value in case of collisions.

impl<K: Ord + 'static, V, A: Array<Item = (K, V)>> VecMap<A>[src]

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

lookup of a mapping. Time complexity is O(log N). Binary search.

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

impl<K: Ord + Clone, V: Clone, A: Array<Item = (K, V)>> VecMap<A>[src]

pub fn outer_join<W: Clone, R, F: Fn(OuterJoinArg<&K, &V, &W>) -> Option<R>, B: Array<Item = (K, W)>>(
    &self,
    that: &VecMap<B>,
    f: F
) -> VecMap1<K, R>
[src]

pub fn left_join<W: Clone, R, F: Fn(&K, &V, Option<&W>) -> Option<R>, B: Array<Item = (K, W)>>(
    &self,
    that: &VecMap1<K, W>,
    f: F
) -> VecMap1<K, R>
[src]

pub fn right_join<W: Clone, R, F: Fn(&K, Option<&V>, &W) -> Option<R>, B: Array<Item = (K, W)>>(
    &self,
    that: &VecMap<B>,
    f: F
) -> VecMap1<K, R>
[src]

pub fn inner_join<W: Clone, R, F: Fn(&K, &V, &W) -> Option<R>, B: Array<Item = (K, W)>>(
    &self,
    that: &VecMap<B>,
    f: F
) -> VecMap1<K, R>
[src]

Trait Implementations

impl<A: Array> AsRef<[<A as Array>::Item]> for VecMap<A>[src]

impl<T: Clone, A: Array<Item = T>> Clone for VecMap<A>[src]

impl<T: Debug, A: Array<Item = T>> Debug for VecMap<A>[src]

impl<A: Array> Default for VecMap<A>[src]

impl<'de, K, V, A: Array<Item = (K, V)>> Deserialize<'de> for VecMap<A> where
    K: Deserialize<'de> + Ord + PartialEq + Clone,
    V: Deserialize<'de>, 
[src]

impl<T: Eq, A: Array<Item = T>> Eq for VecMap<A>[src]

impl<K: Ord + 'static, V, A: Array<Item = (K, V)>> Extend<<A as Array>::Item> for VecMap<A>[src]

impl<K, V, A: Array<Item = (K, V)>> From<BTreeMap<K, V>> for VecMap<A>[src]

impl<A: Array> From<VecMap<A>> for VecSet<A>[src]

impl<K: Ord, V, A: Array<Item = (K, V)>> FromIterator<(K, V)> for VecMap<A>[src]

impl<T: Hash, A: Array<Item = T>> Hash for VecMap<A>[src]

impl<A: Array> Into<SmallVec<A>> for VecMap<A>[src]

impl<'a, A: Array> IntoIterator for &'a VecMap<A>[src]

type Item = &'a A::Item

The type of the elements being iterated over.

type IntoIter = Iter<'a, A::Item>

Which kind of iterator are we turning this into?

impl<A: Array> IntoIterator for VecMap<A>[src]

type Item = A::Item

The type of the elements being iterated over.

type IntoIter = IntoIter<A>

Which kind of iterator are we turning this into?

impl<T: Ord, A: Array<Item = T>> Ord for VecMap<A>[src]

impl<T: PartialEq, A: Array<Item = T>> PartialEq<VecMap<A>> for VecMap<A>[src]

impl<T: PartialOrd, A: Array<Item = T>> PartialOrd<VecMap<A>> for VecMap<A>[src]

impl<K, V, A: Array<Item = (K, V)>> Serialize for VecMap<A> where
    K: Serialize,
    V: Serialize
[src]

Auto Trait Implementations

impl<A> RefUnwindSafe for VecMap<A> where
    A: RefUnwindSafe,
    <A as Array>::Item: RefUnwindSafe

impl<A> Send for VecMap<A> where
    <A as Array>::Item: Send

impl<A> Sync for VecMap<A> where
    A: Sync

impl<A> Unpin for VecMap<A> where
    A: Unpin

impl<A> UnwindSafe for VecMap<A> where
    A: UnwindSafe,
    <A as Array>::Item: RefUnwindSafe

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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.