Trait ic_stable_structures::Memory
source · pub trait Memory {
fn size(&self) -> u64;
fn grow(&self, pages: u64) -> i64;
fn read(&self, offset: u64, dst: &mut [u8]);
fn write(&self, offset: u64, src: &[u8]);
}
Required Methods
sourcefn size(&self) -> u64
fn size(&self) -> u64
Returns the current size of the stable memory in WebAssembly pages. (One WebAssembly page is 64Ki bytes.)
sourcefn grow(&self, pages: u64) -> i64
fn grow(&self, pages: u64) -> i64
Tries to grow the memory by new_pages many pages containing zeroes. If successful, returns the previous size of the memory (in pages). Otherwise, returns -1.