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>
impl<M: Memory, C: Comparator> BTreeMap<M, C>
Sourcepub fn create(
memory: RuntimeMemory<M>,
config: Config,
order: C,
) -> Result<Self, Error>
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.
Sourcepub fn open(
memory: RuntimeMemory<M>,
config: Config,
order: C,
) -> Result<Self, Error>
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.
Sourcepub fn memory_bytes(&self) -> u64
pub fn memory_bytes(&self) -> u64
Bytes reserved, including reusable free pages.
Sourcepub fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>
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.
Sourcepub fn contains_key(&self, key: &[u8]) -> Result<bool, Error>
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.
Sourcepub fn insert(
&mut self,
key: &[u8],
value: &[u8],
) -> Result<Option<Vec<u8>>, Error>
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.
Sourcepub fn remove(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>
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.