pub struct StableCell<T: Storable, M: Memory = DefaultMemoryImpl> { /* private fields */ }Expand description
StableCell
ICSS-baseline single cached value with explicit non-initializing admission. Stored values have no checksum. Malformed application records trap.
Implementations§
Source§impl<T: Storable, M: Memory> StableCell<T, M>
impl<T: Storable, M: Memory> StableCell<T, M>
Sourcepub fn create(
memory: RuntimeMemory<M>,
value: T,
) -> Result<Self, CollectionError>
pub fn create( memory: RuntimeMemory<M>, value: T, ) -> Result<Self, CollectionError>
Sourcepub fn reset(
memory: RuntimeMemory<M>,
value: T,
) -> Result<Self, CollectionError>
pub fn reset( memory: RuntimeMemory<M>, value: T, ) -> Result<Self, CollectionError>
Sourcepub fn load(
memory: RuntimeMemory<M>,
maximum: usize,
) -> Result<Self, CollectionError>
pub fn load( memory: RuntimeMemory<M>, maximum: usize, ) -> Result<Self, CollectionError>
Sourcepub fn set(&mut self, value: T) -> Result<T, CollectionError>
pub fn set(&mut self, value: T) -> Result<T, CollectionError>
Persist a replacement and return the old value. Failures trap.
§Errors
Engine failures trap instead of returning an ordinary error.
Auto Trait Implementations§
impl<T, M = Rc<RefCell<Vec<u8>>>> !RefUnwindSafe for StableCell<T, M>
impl<T, M = Rc<RefCell<Vec<u8>>>> !Send for StableCell<T, M>
impl<T, M = Rc<RefCell<Vec<u8>>>> !Sync for StableCell<T, M>
impl<T, M = Rc<RefCell<Vec<u8>>>> !UnwindSafe for StableCell<T, M>
impl<T, M> Forget for StableCell<T, M>
impl<T, M> Freeze for StableCell<T, M>where
Cell<Codec<T>, Backing<RuntimeMemory<M>>>: Freeze,
impl<T, M> Unpin for StableCell<T, M>where
Cell<Codec<T>, Backing<RuntimeMemory<M>>>: Unpin,
impl<T, M> UnsafeUnpin for StableCell<T, M>where
Cell<Codec<T>, Backing<RuntimeMemory<M>>>: UnsafeUnpin,
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