summaryrefslogtreecommitdiffstats
path: root/third_party/rust/fallible_collections/src/btree.rs
blob: 63d8c6bcf5a01ca57c62ab174c53c7084abd9737 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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>;
}