Skip to main content

BTreeMap

Struct BTreeMap 

Source
pub struct BTreeMap<M: Memory = DefaultMemoryImpl, C: Comparator = Lexicographic> { /* private fields */ }
Expand description

Our page-based tree consuming a governed allocation handle. No raw memory access or extraction is exposed; drop before reopening.

Implementations§

Source§

impl<M: Memory, C: Comparator> BTreeMap<M, C>

Source

pub fn create( memory: RuntimeMemory<M>, config: Config, order: C, ) -> Result<Self, Error>

Create the custom format with the exact configuration and comparator.

§Errors

Returns the engine’s format, configuration, corruption or capacity error.

Source

pub fn open( memory: RuntimeMemory<M>, config: Config, order: C, ) -> Result<Self, Error>

Open the custom format with the exact configuration and comparator.

§Errors

Returns the engine’s format, configuration, corruption or capacity error.

Source

pub fn len(&self) -> u64

Number of persisted live entries.

Source

pub fn is_empty(&self) -> bool

Whether there are no live entries.

Source

pub fn memory_bytes(&self) -> u64

Bytes reserved, including reusable free pages.

Source

pub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>

Read the value for an encoded key.

§Errors

Propagates validation, corruption and capacity errors from the engine.

Source

pub fn contains_key(&self, key: &[u8]) -> Result<bool, Error>

Test membership without reading external value payloads.

§Errors

Propagates validation, corruption and capacity errors from the engine.

Source

pub fn insert( &mut self, key: &[u8], value: &[u8], ) -> Result<Option<Vec<u8>>, Error>

Insert or replace a value, returning its previous bytes.

§Errors

Propagates validation, corruption and capacity errors from the engine.

Source

pub fn remove(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>

Remove a key, returning its previous value.

§Errors

Propagates validation, corruption and capacity errors from the engine.

Source

pub fn range( &self, lower: Bound<&[u8]>, upper: Bound<&[u8]>, ) -> Result<Range<'_, M, C>, Error>

Lazily scan comparator-ordered bounds in either direction.

§Errors

Propagates validation, corruption and capacity errors from the engine.

Source

pub fn iter(&self) -> Range<'_, M, C>

Lazily scan all entries in either direction.

Source

pub fn validate(&self) -> Result<(), Error>

Audit reachable pages, ordering, counts and free-list ownership.

§Errors

Propagates validation, corruption and capacity errors from the engine.

Trait Implementations§

Source§

impl<'a, M: Memory, C: Comparator> IntoIterator for &'a BTreeMap<M, C>

Source§

type Item = Result<Entry<'a, RuntimeMemory<M>, C>, Error>

The type of the elements being iterated over.
Source§

type IntoIter = Range<'a, RuntimeMemory<M>, C>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<M = Rc<RefCell<Vec<u8>>>, C = Lexicographic> !Freeze for BTreeMap<M, C>

§

impl<M = Rc<RefCell<Vec<u8>>>, C = Lexicographic> !RefUnwindSafe for BTreeMap<M, C>

§

impl<M = Rc<RefCell<Vec<u8>>>, C = Lexicographic> !Send for BTreeMap<M, C>

§

impl<M = Rc<RefCell<Vec<u8>>>, C = Lexicographic> !Sync for BTreeMap<M, C>

§

impl<M = Rc<RefCell<Vec<u8>>>, C = Lexicographic> !UnwindSafe for BTreeMap<M, C>

§

impl<M, C> Unpin for BTreeMap<M, C>
where BTreeMap<RuntimeMemory<M>, C>: Unpin,

§

impl<M, C> UnsafeUnpin for BTreeMap<M, C>
where BTreeMap<RuntimeMemory<M>, C>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.