pub struct StableBTreeSet<K: Storable + Ord + Clone, M: Memory = DefaultMemoryImpl> { /* private fields */ }Expand description
Governed ordered set sharing Storage’s owned map engine with unit values.
Implementations§
Source§impl<K: Storable + Ord + Clone, M: Memory> StableBTreeSet<K, M>
impl<K: Storable + Ord + Clone, M: Memory> StableBTreeSet<K, M>
Sourcepub fn create(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
pub fn create(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
Create a collection only in zero-page memory.
§Errors
Refuses nonempty memory, invalid encoding or capacity exhaustion before writes.
Sourcepub fn reset(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
pub fn reset(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
Deliberately replace any contents in this admitted allocation.
§Errors
Returns encoding, capacity or structural admission errors.
Sourcepub fn load(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
pub fn load(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
Load retained collection state without initializing a replacement.
§Errors
Refuses empty, foreign or corrupt memory and incompatible bounds without writing.
Sourcepub fn insert(&mut self, key: K) -> Result<bool, CollectionError>
pub fn insert(&mut self, key: K) -> Result<bool, CollectionError>
Perform insert on the governed ordered set.
§Errors
Rejects encoding, decoding, structural or capacity errors before committing writes.
Sourcepub fn contains(&self, key: &K) -> Result<bool, CollectionError>
pub fn contains(&self, key: &K) -> Result<bool, CollectionError>
Perform contains on the governed ordered set.
§Errors
Reports structural, integrity or application decoding failures without writing.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Perform is_empty on the governed ordered set.
§Errors
Reports invalid region metadata or incompatible codec bounds.