pub struct StableBTreeSet<K: Storable + Ord + Clone, M: Memory = DefaultMemoryImpl> { /* private fields */ }Expand description
Governed upstream BTreeSet; initialization and failures follow upstream contracts.
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>) -> Self
pub fn create(memory: RuntimeMemory<M>) -> Self
Create a collection only in zero-page memory.
§Panics
Refuses nonempty memory before writing. Growth and codec failures retain upstream behavior.
Sourcepub fn reset(memory: RuntimeMemory<M>) -> Self
pub fn reset(memory: RuntimeMemory<M>) -> Self
Deliberately replace any contents in this admitted allocation.
§Panics
Growth and codec failures retain upstream behavior.
Sourcepub fn load(memory: RuntimeMemory<M>) -> Self
pub fn load(memory: RuntimeMemory<M>) -> Self
Load retained collection state without initializing a replacement.
§Panics
Refuses empty or foreign memory and incompatible layouts/bounds without writing. Record decoding and backing failures retain upstream behavior.
Sourcepub fn insert(&mut self, key: K) -> bool
pub fn insert(&mut self, key: K) -> bool
Delegates to upstream BTreeSet::insert with the governed allocation.
Sourcepub fn contains(&self, key: &K) -> bool
pub fn contains(&self, key: &K) -> bool
Delegates to upstream BTreeSet::contains with the governed allocation.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Delegates to upstream BTreeSet::is_empty with the governed allocation.
Sourcepub fn remove(&mut self, key: &K) -> bool
pub fn remove(&mut self, key: &K) -> bool
Delegates to upstream BTreeSet::remove with the governed allocation.
Sourcepub fn first(&self) -> Option<K>
pub fn first(&self) -> Option<K>
Delegates to upstream BTreeSet::first with the governed allocation.
Sourcepub fn last(&self) -> Option<K>
pub fn last(&self) -> Option<K>
Delegates to upstream BTreeSet::last with the governed allocation.
Sourcepub fn pop_first(&mut self) -> Option<K>
pub fn pop_first(&mut self) -> Option<K>
Delegates to upstream BTreeSet::pop_first with the governed allocation.
Sourcepub fn pop_last(&mut self) -> Option<K>
pub fn pop_last(&mut self) -> Option<K>
Delegates to upstream BTreeSet::pop_last with the governed allocation.
Sourcepub fn iter(&self) -> SetIter<'_, K, M>
pub fn iter(&self) -> SetIter<'_, K, M>
Delegates to upstream BTreeSet::iter with the governed allocation.
Sourcepub fn range(&self, key_range: impl RangeBounds<K>) -> SetIter<'_, K, M>
pub fn range(&self, key_range: impl RangeBounds<K>) -> SetIter<'_, K, M>
Delegates to upstream BTreeSet::range with the governed allocation.