diff options
Diffstat (limited to 'third_party/rust/fallible_collections/src/btree.rs')
-rw-r--r-- | third_party/rust/fallible_collections/src/btree.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/third_party/rust/fallible_collections/src/btree.rs b/third_party/rust/fallible_collections/src/btree.rs new file mode 100644 index 0000000000..63d8c6bcf5 --- /dev/null +++ b/third_party/rust/fallible_collections/src/btree.rs @@ -0,0 +1,20 @@ +//! Implement Fallible Btree, As there is no try_reserve methods on btree, I add no choice but to fork the std implementation and change return types. +//! Currently this functionality is only available when building this crate with nightly and the `unstable` feature. +pub mod map; +pub use map::BTreeMap; + +pub mod set; +pub use set::BTreeSet; + +mod node; +mod search; +use crate::TryReserveError; + +#[doc(hidden)] +trait Recover<Q: ?Sized> { + type Key; + + fn get(&self, key: &Q) -> Option<&Self::Key>; + fn take(&mut self, key: &Q) -> Option<Self::Key>; + fn replace(&mut self, key: Self::Key) -> Result<Option<Self::Key>, TryReserveError>; +} |