structures/bimultimap
A bidirectional multi map (BiMultiMap) A data structure that stores associations between keys and values in both directions A key can point to multiple values A value can point to multiple keys
For example, keys have association to values:
animal → [cat, lion]
pet → [cat]
And values have reverse association to those keys
cat → [animal, pet]
lion → [animal]
Types
pub opaque type BiMultiMap(k, v)
Values
pub fn delete(
from from: BiMultiMap(k, v),
key key: k,
) -> BiMultiMap(k, v)
Delete a key from the multimap This removes the association from this key to any values and from values to this key
pub fn delete_key_val(
from from: BiMultiMap(k, v),
key key: k,
value value: v,
) -> BiMultiMap(k, v)
Delete a specific combination of key and value
pub fn delete_val(
from from: BiMultiMap(k, v),
value value: v,
) -> BiMultiMap(k, v)
Delete a value from the multimap This removes association from keys to this value and from this value to keys
pub fn get(from from: BiMultiMap(k, v), key key: k) -> set.Set(v)
Get the associated values for a key
pub fn get_val(
from from: BiMultiMap(k, v),
value value: v,
) -> set.Set(k)
Get the associated keys for a value
pub fn insert(
into into: BiMultiMap(k, v),
key key: k,
value value: v,
) -> BiMultiMap(k, v)
Insert a key an associated value
pub fn new() -> BiMultiMap(a, b)