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 or initial growth refusal; engine failures trap.
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 initial growth refusal; engine failures trap.
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 or foreign framing; malformed engine state traps.
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
Engine and codec failures trap, possibly after writes on native hosts.
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
Engine and codec failures trap instead of returning an ordinary error.
Trait Implementations§
Source§impl<'a, K: Storable + Ord + Clone, M: Memory> IntoIterator for &'a StableBTreeSet<K, M>
impl<'a, K: Storable + Ord + Clone, M: Memory> IntoIterator for &'a StableBTreeSet<K, M>
Auto Trait Implementations§
impl<K, M = Rc<RefCell<Vec<u8>>>> !RefUnwindSafe for StableBTreeSet<K, M>
impl<K, M = Rc<RefCell<Vec<u8>>>> !Send for StableBTreeSet<K, M>
impl<K, M = Rc<RefCell<Vec<u8>>>> !Sync for StableBTreeSet<K, M>
impl<K, M = Rc<RefCell<Vec<u8>>>> !UnwindSafe for StableBTreeSet<K, M>
impl<K, M> Forget for StableBTreeSet<K, M>
impl<K, M> Freeze for StableBTreeSet<K, M>
impl<K, M> Unpin for StableBTreeSet<K, M>
impl<K, M> UnsafeUnpin for StableBTreeSet<K, M>
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