pub struct StableVec<T: Storable, M: Memory = DefaultMemoryImpl> { /* private fields */ }Expand description
StableVec
ICSS-baseline fixed-stride vector in one governed allocation. There are no custom checksums, cached length, read windows or mutation epochs. Malformed stored values trap; IC execution rollback supplies atomicity.
Implementations§
Source§impl<T: Storable, M: Memory> StableVec<T, M>
impl<T: Storable, M: Memory> StableVec<T, M>
Sourcepub fn create(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
pub fn create(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
Sourcepub fn reset(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
pub fn reset(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
Sourcepub fn load(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
pub fn load(memory: RuntimeMemory<M>) -> Result<Self, CollectionError>
Load the current SVC format without initialization.
§Errors
Refuses empty/foreign framing; engine/codec failures trap.
Sourcepub fn get(&self, index: u64) -> Result<Option<T>, CollectionError>
pub fn get(&self, index: u64) -> Result<Option<T>, CollectionError>
Read one indexed record; malformed stored bytes trap.
§Errors
Engine failures trap instead of returning an ordinary error.
Sourcepub fn set(&self, index: u64, item: &T) -> Result<(), CollectionError>
pub fn set(&self, index: u64, item: &T) -> Result<(), CollectionError>
Replace one record; invalid codecs, bounds or writes trap.
§Errors
Engine failures trap instead of returning an ordinary error.
Sourcepub fn push(&self, item: &T) -> Result<(), CollectionError>
pub fn push(&self, item: &T) -> Result<(), CollectionError>
Append one record, publishing its length last.
§Errors
Engine failures trap instead of returning an ordinary error.
Sourcepub fn pop(&self) -> Result<Option<T>, CollectionError>
pub fn pop(&self) -> Result<Option<T>, CollectionError>
Remove the final record; failures trap.
§Errors
Engine failures trap instead of returning an ordinary error.
Sourcepub fn iter(
&self,
) -> impl DoubleEndedIterator<Item = Result<T, CollectionError>> + '_
pub fn iter( &self, ) -> impl DoubleEndedIterator<Item = Result<T, CollectionError>> + '_
Scalar bidirectional iteration with one reusable buffer, as in ICSS.