Skip to main content

wasmtime_environ/
collections.rs

1//! Fallible, OOM-handling collections.
2
3pub mod btree_map;
4mod entity_set;
5mod hash_map;
6mod hash_set;
7mod index_map;
8mod index_set;
9mod primary_map;
10mod secondary_map;
11
12pub use btree_map::TryBTreeMap;
13pub use entity_set::TryEntitySet;
14pub use hash_map::TryHashMap;
15pub use hash_set::TryHashSet;
16pub use index_map::TryIndexMap;
17pub use index_set::TryIndexSet;
18pub use primary_map::TryPrimaryMap;
19pub use secondary_map::TrySecondaryMap;
20pub use wasmtime_core::{
21    alloc::{
22        TryClone, TryCollect, TryCow, TryExtend, TryFromIterator, TryNew, TryString, TryToOwned,
23        TryVec, try_new,
24    },
25    try_vec,
26};
27
28/// Collections which abort on OOM.
29//
30// FIXME(#12069) this is just here for Wasmtime at this time. Ideally
31// collections would only be fallible in this module and would handle OOM. We're
32// in a bit of a transition period though.
33pub mod oom_abort {
34    #[cfg(not(feature = "std"))]
35    pub use hashbrown::{hash_map, hash_set};
36    #[cfg(feature = "std")]
37    pub use std::collections::{hash_map, hash_set};
38
39    pub use self::hash_map::HashMap;
40    pub use self::hash_set::HashSet;
41}