]> git.lizzy.rs Git - rust.git/blob - library/alloc/src/collections/btree/mod.rs
Auto merge of #74785 - euclio:deprecation-kinds, r=petrochenkov
[rust.git] / library / alloc / src / collections / btree / mod.rs
1 pub mod map;
2 mod navigate;
3 mod node;
4 mod search;
5 pub mod set;
6
7 #[doc(hidden)]
8 trait Recover<Q: ?Sized> {
9     type Key;
10
11     fn get(&self, key: &Q) -> Option<&Self::Key>;
12     fn take(&mut self, key: &Q) -> Option<Self::Key>;
13     fn replace(&mut self, key: Self::Key) -> Option<Self::Key>;
14 }
15
16 #[inline(always)]
17 pub unsafe fn unwrap_unchecked<T>(val: Option<T>) -> T {
18     val.unwrap_or_else(|| {
19         if cfg!(debug_assertions) {
20             panic!("'unchecked' unwrap on None in BTreeMap");
21         } else {
22             unsafe {
23                 core::intrinsics::unreachable();
24             }
25         }
26     })
27 }