pub struct BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,{ /* private fields */ }Expand description
The main data structure for the B-tree algorithm.
Implementations§
Source§impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
Source§impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
Sourcepub fn try_insert_or_update(
&mut self,
key: TKey,
adder: impl FnOnce() -> TValue,
updater: impl FnOnce(&mut TValue),
) -> Result<&mut TValue, BTreeError>
pub fn try_insert_or_update( &mut self, key: TKey, adder: impl FnOnce() -> TValue, updater: impl FnOnce(&mut TValue), ) -> Result<&mut TValue, BTreeError>
Inserts a (key, adder()) pair into the tree if it doesn’t exist, or updates the value
with update(value) call.
§Notes
- If the key already exists, then this method discards
key. - This method guarantees that either
adderorupdaterwill be called, but not both.
§Errors
See BTreeError for details.
Sourcepub fn try_insert(
&mut self,
key: TKey,
value: TValue,
) -> Result<Option<TValue>, BTreeError>
pub fn try_insert( &mut self, key: TKey, value: TValue, ) -> Result<Option<TValue>, BTreeError>
Inserts a (key, value) pair into the tree.
Returns None if the key was not already present, or the previous value if it was.
§Notes
This method discards key if it already exists.
§Errors
See BTreeError for details.
Source§impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
Source§impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
Source§impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
impl<TKey, TValue, TConfig> BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
Trait Implementations§
Source§impl<TKey, TValue, TConfig> Clone for BTree<TKey, TValue, TConfig>where
TKey: Ord + TryClone,
TValue: TryClone,
TConfig: BTreeConfig + TryClone,
impl<TKey, TValue, TConfig> Clone for BTree<TKey, TValue, TConfig>where
TKey: Ord + TryClone,
TValue: TryClone,
TConfig: BTreeConfig + TryClone,
Source§impl<'de, TKey, TValue, TConfig> Deserialize<'de> for BTree<TKey, TValue, TConfig>
Available on crate feature serde only.
impl<'de, TKey, TValue, TConfig> Deserialize<'de> for BTree<TKey, TValue, TConfig>
Available on crate feature
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<TKey, TValue, TConfig> Drop for BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
impl<TKey, TValue, TConfig> Drop for BTree<TKey, TValue, TConfig>where
TKey: Ord,
TConfig: BTreeConfig,
impl<TKey, TValue, TConfig> Eq for BTree<TKey, TValue, TConfig>
Source§impl<TKey, TValue, TConfig> ReprC for BTree<TKey, TValue, TConfig>where
TKey: Ord + ReprC,
TValue: ReprC,
TConfig: BTreeConfig,
impl<TKey, TValue, TConfig> ReprC for BTree<TKey, TValue, TConfig>where
TKey: Ord + ReprC,
TValue: ReprC,
TConfig: BTreeConfig,
impl<TKey, TValue, TConfig> Send for BTree<TKey, TValue, TConfig>
Source§impl<TKey, TValue, TConfig> Serialize for BTree<TKey, TValue, TConfig>
Available on crate feature serde only.
impl<TKey, TValue, TConfig> Serialize for BTree<TKey, TValue, TConfig>
Available on crate feature
serde only.impl<TKey, TValue, TConfig> Sync for BTree<TKey, TValue, TConfig>
Auto Trait Implementations§
impl<TKey, TValue, TConfig> Freeze for BTree<TKey, TValue, TConfig>where
TConfig: Freeze,
impl<TKey, TValue, TConfig> RefUnwindSafe for BTree<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> Unpin for BTree<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> UnsafeUnpin for BTree<TKey, TValue, TConfig>where
TConfig: UnsafeUnpin,
impl<TKey, TValue, TConfig> UnwindSafe for BTree<TKey, TValue, TConfig>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more