pub struct StableCell<T: Storable, M: Memory = DefaultMemoryImpl> { /* private fields */ }Expand description
Governed upstream Cell; initialization and failures follow upstream contracts.
Implementations§
Source§impl<T: Storable, M: Memory> StableCell<T, M>
impl<T: Storable, M: Memory> StableCell<T, M>
Sourcepub fn new(memory: RuntimeMemory<M>, value: T) -> Self
pub fn new(memory: RuntimeMemory<M>, value: T) -> Self
Create a new collection, replacing any prior collection in the selected memory. This is destructive even when a valid collection already exists.
§Panics
Panics on insufficient memory or codec/backing failure.
Sourcepub fn init(memory: RuntimeMemory<M>, default_value: T) -> Self
pub fn init(memory: RuntimeMemory<M>, default_value: T) -> Self
Open a recognized retained collection; initialize a new one when memory is empty or has foreign magic. Foreign contents may be overwritten. This is not a corruption-recovery or schema-admission operation.
§Panics
Panics for unsupported recognized layouts, invalid retained contents, insufficient memory or codec/backing failure.
Auto Trait Implementations§
impl<T, M = Rc<RefCell<Vec<u8>>>> !Freeze for StableCell<T, M>
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> Unpin for StableCell<T, M>
impl<T, M> UnsafeUnpin for StableCell<T, 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