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