Skip to content

Additional Rust collections not found in std::collections

License

Notifications You must be signed in to change notification settings

jankeu/more_collections

 
 

Repository files navigation

More collections   Latest Version Docs badge License: Apache-2.0

Additional Rust collections not found in std::collections.

Small* collections

Built on top of the excellent smallvec crate, SmallMap and SmallSet are a Map and Set respectively that are inlined if they contain fewer values than a (statically chosen) capacity C, otherwise they are heap allocated and backed by an IndexMap.

Multimaps

Completion Name Behaves as
🟩🟩🟩🟩🟨 HashSetMultimap HashMap<K, HashSet<V>>
🟩🟩🟩🟩🟨 HashVecMultimap HashMap<K, Vec<V>>
🟩🟩🟩🟩🟨 IndexSetMultimap IndexMap<K, IndexSet<V>>
🟩🟩🟩🟩🟨 IndexVecMultimap IndexMap<K, Vec<V>>
⬜️⬜️⬜️⬜️⬜️ BTreeSetMultimap BTreeMap<K, BTreeSet<V>>
⬜️⬜️⬜️⬜️⬜️ BTreeVecMultimap BTreeMap<K, Vec<V>>
⬜️⬜️⬜️⬜️⬜️ EnumHashSetMultimap EnumMap<K, HashSet<V>>
⬜️⬜️⬜️⬜️⬜️ EnumIndexSetMultimap EnumMap<K, IndexSet<V>>
⬜️⬜️⬜️⬜️⬜️ EnumVecMultimap EnumMap<K, Vec<V>>
⬜️⬜️⬜️⬜️⬜️ EnumEnumMultimap EnumMap<K, EnumSet<V>>

Multisets

Completion Name Behaves as
⬜️⬜️⬜️⬜️⬜️ IndexMultiset IndexMap<K,usize>
⬜️⬜️⬜️⬜️⬜️ HashMultiset HashMap<K,usize>
⬜️⬜️⬜️⬜️⬜️ BTreeMultiset BTreeMap<K,usize>
⬜️⬜️⬜️⬜️⬜️ EnumMultiset EnumMap<K,usize>

Multimaps overview

Method HashSetMultimap HashVecMultimap IndexSetMultimap IndexVecMultimap
new()
with_key_capacity()
with_hasher()
with_key_capacity_and_hasher()
key_capacity()
keys()
values()
values_mut() maybe maybe maybe maybe
iter()
len()
is_empty()
keys_len()
reserve()
shrink_keys_to_fit()
shrink_values_to_fit()
shrink_keys_to() planned planned - -
shrink_values_to() planned planned - planned
entry() planned planned planned planned
get()
get_key_values()
contains_key()
get_mut() maybe maybe maybe maybe
insert()
remove_key()
remove_key_entry()
retain()
into_keys()
into_values()
remove()
contains()
as_map()
into_map()
IndexMap keys methods
insert_full() - -
get_full() - -
get_key_index() - -
get_full_mut() - - maybe maybe
swap_remove() - - planned planned
swap_remove_entry() - - planned planned
swap_remove_full() - - planned planned
shift_remove() - - planned planned
shift_remove_entry() - - planned planned
shift_remove_full() - - planned planned
pop() - - planned planned
sort_keys() - - planned planned
sort_by() - - planned planned
sorted_by() - - planned planned
reverse() - - planned planned
get_index() - - planned planned
get_index_mut() - - maybe maybe
first() - - planned planned
first_mut() - - maybe maybe
last() - - planned planned
last_mut() - - maybe maybe
swap_remove_index() - - planned planned
shift_remove_index() - - planned planned
swap_indices() - - planned planned
Set values methods
difference() planned - planned -
symmetric_difference() planned - planned -
intersection() planned - planned -
union() planned - planned -
is_disjoint() planned - planned -
is_subset() planned - planned -
is_superset() planned - planned -
Consistent ordered values methods
sort_values() - planned planned planned
sort_values_by() - planned planned planned
TODO consider adding more mutators
Traits
Extend
FromIterator
From wrapped type
IntoIterator
Default
Index
Eq
PartialEq
Debug
Clone
Serializable planned planned planned planned
Deserializable planned planned planned planned

Todo

About

Additional Rust collections not found in std::collections

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 99.6%
  • Makefile 0.4%