pub struct HashMapValues<K>(_);
Expand description
std::collections::HashMap
lifted to an HKT1
with a fixed key type
(Kind Type -> Type
)
Trait Implementations§
source§impl<K, A> Alt<HashMapValues<K>, A> for HashMap<K, A>where
K: Eq + Hash,
impl<K, A> Alt<HashMapValues<K>, A> for HashMap<K, A>where K: Eq + Hash,
source§fn alt(self, b: Self) -> Self
fn alt(self, b: Self) -> Self
Combine the two maps, preferring keys from self
when self
and b
both have an entry for a given key.
use std::collections::HashMap;
use naan::prelude::*;
let a_union_b = HashMap::from([("a", 1), ("b", 2)]).alt(HashMap::from([("b", 3), ("c", 3)]));
assert_eq!(a_union_b, HashMap::from([("a", 1), ("b", 2), ("c", 3)]))
source§impl<K, AB> Apply<HashMapValues<K>, AB> for HashMap<K, AB>where
K: Eq + Hash,
impl<K, AB> Apply<HashMapValues<K>, AB> for HashMap<K, AB>where K: Eq + Hash,
source§impl<A, K> Foldable<HashMapValues<K>, A> for HashMap<K, A>where
K: Eq + Hash,
impl<A, K> Foldable<HashMapValues<K>, A> for HashMap<K, A>where K: Eq + Hash,
source§fn foldl<B, BAB>(self, f: BAB, b: B) -> Bwhere
BAB: F2<B, A, Ret = B>,
fn foldl<B, BAB>(self, f: BAB, b: B) -> Bwhere BAB: F2<B, A, Ret = B>,
Fold the data structure from left -> right
source§fn foldr<B, ABB>(self, f: ABB, b: B) -> Bwhere
ABB: F2<A, B, Ret = B>,
fn foldr<B, ABB>(self, f: ABB, b: B) -> Bwhere ABB: F2<A, B, Ret = B>,
Fold the data structure from right -> left
source§fn foldl_ref<'a, B, BAB>(&'a self, f: BAB, b: B) -> Bwhere
BAB: F2<B, &'a A, Ret = B>,
A: 'a,
fn foldl_ref<'a, B, BAB>(&'a self, f: BAB, b: B) -> Bwhere BAB: F2<B, &'a A, Ret = B>, A: 'a,
Fold the data structure from left -> right
source§fn foldr_ref<'a, B, ABB>(&'a self, f: ABB, b: B) -> Bwhere
ABB: F2<&'a A, B, Ret = B>,
A: 'a,
fn foldr_ref<'a, B, ABB>(&'a self, f: ABB, b: B) -> Bwhere ABB: F2<&'a A, B, Ret = B>, A: 'a,
Fold the data structure from right -> left
source§fn contains<'a>(&'a self, a: &'a A) -> boolwhere
&'a A: PartialEq,
A: 'a,
fn contains<'a>(&'a self, a: &'a A) -> boolwhere &'a A: PartialEq, A: 'a,
Test if the structure contains a value
a
Read moresource§fn not_contains<'a>(&'a self, a: &'a A) -> boolwhere
&'a A: PartialEq,
A: 'a,
fn not_contains<'a>(&'a self, a: &'a A) -> boolwhere &'a A: PartialEq, A: 'a,
Test if the structure does not contain a value
a
Read moresource§fn any<'a, P>(&'a self, f: P) -> boolwhere
P: F1<&'a A, Ret = bool>,
A: 'a,
fn any<'a, P>(&'a self, f: P) -> boolwhere P: F1<&'a A, Ret = bool>, A: 'a,
Test if any element in the structure satisfies a predicate
f
Read moresource§fn all<'a, P>(&'a self, f: P) -> boolwhere
P: F1<&'a A, Ret = bool>,
A: 'a,
fn all<'a, P>(&'a self, f: P) -> boolwhere P: F1<&'a A, Ret = bool>, A: 'a,
Test if every element in the structure satisfies a predicate
f
Read moresource§impl<A, K> FoldableIndexed<HashMapValues<K>, K, A> for HashMap<K, A>where
K: Eq + Hash + Clone,
impl<A, K> FoldableIndexed<HashMapValues<K>, K, A> for HashMap<K, A>where K: Eq + Hash + Clone,
source§fn foldl_idx<B, BAB>(self, f: BAB, b: B) -> Bwhere
BAB: F3<B, K, A, Ret = B>,
fn foldl_idx<B, BAB>(self, f: BAB, b: B) -> Bwhere BAB: F3<B, K, A, Ret = B>,
Fold the data structure from left -> right
source§fn foldr_idx<B, ABB>(self, f: ABB, b: B) -> Bwhere
ABB: F3<K, A, B, Ret = B>,
fn foldr_idx<B, ABB>(self, f: ABB, b: B) -> Bwhere ABB: F3<K, A, B, Ret = B>,
Fold the data structure from right -> left
source§fn foldl_idx_ref<'a, B, BAB>(&'a self, f: BAB, b: B) -> Bwhere
BAB: F3<B, K, &'a A, Ret = B>,
A: 'a,
fn foldl_idx_ref<'a, B, BAB>(&'a self, f: BAB, b: B) -> Bwhere BAB: F3<B, K, &'a A, Ret = B>, A: 'a,
Fold the data structure from left -> right
source§fn foldr_idx_ref<'a, B, ABB>(&'a self, f: ABB, b: B) -> Bwhere
ABB: F3<K, &'a A, B, Ret = B>,
A: 'a,
fn foldr_idx_ref<'a, B, ABB>(&'a self, f: ABB, b: B) -> Bwhere ABB: F3<K, &'a A, B, Ret = B>, A: 'a,
Fold the data structure from right -> left
source§impl<K> HKT1 for HashMapValues<K>where
K: Hash + Eq,
impl<K> HKT1 for HashMapValues<K>where K: Hash + Eq,
§type T<A> = HashMap<K, A, RandomState>
type T<A> = HashMap<K, A, RandomState>
The generic type
source§impl<K, A, B> Traversable<HashMapValues<K>, A, B, Curry3<fn(_: K, _: B, _: HashMap<K, B, RandomState>) -> HashMap<K, B, RandomState>, Just<K>, Just<B>, Nothing<HashMap<K, B, RandomState>>, HashMap<K, B, RandomState>>> for HashMap<K, A>where
K: Clone + Eq + Hash,
HashMapValues<K>: HKT1<T<B> = HashMap<K, B>>,
impl<K, A, B> Traversable<HashMapValues<K>, A, B, Curry3<fn(_: K, _: B, _: HashMap<K, B, RandomState>) -> HashMap<K, B, RandomState>, Just<K>, Just<B>, Nothing<HashMap<K, B, RandomState>>, HashMap<K, B, RandomState>>> for HashMap<K, A>where K: Clone + Eq + Hash, HashMapValues<K>: HKT1<T<B> = HashMap<K, B>>,
source§fn traversem1<Ap, AtoApOfB>(self, f: AtoApOfB) -> Ap::T<HashMap<K, B>>where
Ap: HKT1,
Self: Foldable<HashMapValues<K>, A>,
Ap::T<B>: Applicative<Ap, B> + ApplyOnce<Ap, B>,
Ap::T<insert2<K, B>>: Applicative<Ap, insert2<K, B>> + ApplyOnce<Ap, insert2<K, B>>,
Ap::T<HashMap<K, B>>: Applicative<Ap, HashMap<K, B>> + ApplyOnce<Ap, HashMap<K, B>>,
AtoApOfB: F1<A, Ret = Ap::T<B>>,
HashMapValues<K>: HKT1<T<A> = Self>,
fn traversem1<Ap, AtoApOfB>(self, f: AtoApOfB) -> Ap::T<HashMap<K, B>>where Ap: HKT1, Self: Foldable<HashMapValues<K>, A>, Ap::T<B>: Applicative<Ap, B> + ApplyOnce<Ap, B>, Ap::T<insert2<K, B>>: Applicative<Ap, insert2<K, B>> + ApplyOnce<Ap, insert2<K, B>>, Ap::T<HashMap<K, B>>: Applicative<Ap, HashMap<K, B>> + ApplyOnce<Ap, HashMap<K, B>>, AtoApOfB: F1<A, Ret = Ap::T<B>>, HashMapValues<K>: HKT1<T<A> = Self>,
Traverse a structure with 0 or more elements, collecting into
an Applicative of 0 or 1 elements. Read more
source§fn traversemm<Ap, AtoApOfB>(self, f: AtoApOfB) -> Ap::T<HashMap<K, B>>where
Ap: HKT1,
Self: Foldable<HashMapValues<K>, A>,
B: Clone,
Ap::T<B>: Applicative<Ap, B>,
Ap::T<insert2<K, B>>: Applicative<Ap, insert2<K, B>>,
Ap::T<HashMap<K, B>>: Applicative<Ap, HashMap<K, B>>,
AtoApOfB: F1<A, Ret = Ap::T<B>>,
HashMapValues<K>: HKT1<T<A> = Self>,
fn traversemm<Ap, AtoApOfB>(self, f: AtoApOfB) -> Ap::T<HashMap<K, B>>where Ap: HKT1, Self: Foldable<HashMapValues<K>, A>, B: Clone, Ap::T<B>: Applicative<Ap, B>, Ap::T<insert2<K, B>>: Applicative<Ap, insert2<K, B>>, Ap::T<HashMap<K, B>>: Applicative<Ap, HashMap<K, B>>, AtoApOfB: F1<A, Ret = Ap::T<B>>, HashMapValues<K>: HKT1<T<A> = Self>,
Traverse a structure with 0 or more elements, collecting into
an Applicative of 0 or more elements.
Auto Trait Implementations§
impl<K> RefUnwindSafe for HashMapValues<K>where K: RefUnwindSafe,
impl<K> Send for HashMapValues<K>where K: Send,
impl<K> Sync for HashMapValues<K>where K: Sync,
impl<K> Unpin for HashMapValues<K>where K: Unpin,
impl<K> UnwindSafe for HashMapValues<K>where K: UnwindSafe,
Blanket Implementations§
source§impl<F, A, TF, T> Sequence<F, A, TF> for T
impl<F, A, TF, T> Sequence<F, A, TF> for T
source§fn sequence<Ap>(self) -> Ap::T<F::T<A>>where
Self: Sized + Traversable<F, Ap::T<A>, A, TF> + Foldable<F, Ap::T<A>>,
Ap: HKT1,
Ap::T<A>: Applicative<Ap, A> + ApplyOnce<Ap, A>,
Ap::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>,
Ap::T<F::T<A>>: Applicative<Ap, F::T<A>> + ApplyOnce<Ap, F::T<A>>,
F: HKT1<T<Ap::T<A>> = Self>,
fn sequence<Ap>(self) -> Ap::T<F::T<A>>where Self: Sized + Traversable<F, Ap::T<A>, A, TF> + Foldable<F, Ap::T<A>>, Ap: HKT1, Ap::T<A>: Applicative<Ap, A> + ApplyOnce<Ap, A>, Ap::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>, Ap::T<F::T<A>>: Applicative<Ap, F::T<A>> + ApplyOnce<Ap, F::T<A>>, F: HKT1<T<Ap::T<A>> = Self>,
See
Sequence