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

Returns the current size of the stable memory in WebAssembly pages. (One WebAssembly page is 64Ki bytes.)

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.

Copies the data referred to by offset out of the stable memory and replaces the corresponding bytes in dst.

Copies the data referred to by src and replaces the corresponding segment starting at offset in the stable memory.

Implementations on Foreign Types

Implementors