pub struct StableVec<T: Storable, M: Memory = DefaultMemoryImpl> { /* private fields */ }Expand description
Governed upstream Vec; initialization and failures follow upstream contracts.
Implementations§
Source§impl<T: Storable, M: Memory> StableVec<T, M>
impl<T: Storable, M: Memory> StableVec<T, M>
Sourcepub fn new(memory: RuntimeMemory<M>) -> Self
pub fn new(memory: RuntimeMemory<M>) -> Self
Delegates to upstream Vec::new with the governed allocation.
Sourcepub fn init(memory: RuntimeMemory<M>) -> Self
pub fn init(memory: RuntimeMemory<M>) -> Self
Delegates to upstream Vec::init with the governed allocation.
Sourcepub fn get(&self, index: u64) -> Option<T>
pub fn get(&self, index: u64) -> Option<T>
Delegates to upstream Vec::get with the governed allocation.
Sourcepub fn set(&self, index: u64, item: &T)
pub fn set(&self, index: u64, item: &T)
Delegates to upstream Vec::set with the governed allocation.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Delegates to upstream Vec::is_empty with the governed allocation.
Sourcepub fn iter(&self) -> impl DoubleEndedIterator<Item = T> + '_
pub fn iter(&self) -> impl DoubleEndedIterator<Item = T> + '_
Delegates to upstream Vec::iter with the governed allocation.
Auto Trait Implementations§
impl<T, M = Rc<RefCell<Vec<u8>>>> !Freeze for StableVec<T, M>
impl<T, M = Rc<RefCell<Vec<u8>>>> !RefUnwindSafe for StableVec<T, M>
impl<T, M = Rc<RefCell<Vec<u8>>>> !Send for StableVec<T, M>
impl<T, M = Rc<RefCell<Vec<u8>>>> !Sync for StableVec<T, M>
impl<T, M = Rc<RefCell<Vec<u8>>>> !UnwindSafe for StableVec<T, M>
impl<T, M> Unpin for StableVec<T, M>
impl<T, M> UnsafeUnpin for StableVec<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