Trait sp_sandbox::SandboxMemory
source · pub trait SandboxMemory: Sized + Clone {
fn new(initial: u32, maximum: Option<u32>) -> Result<Self, Error>;
fn get(&self, ptr: u32, buf: &mut [u8]) -> Result<(), Error>;
fn set(&self, ptr: u32, value: &[u8]) -> Result<(), Error>;
}Expand description
Required Methods§
sourcefn new(initial: u32, maximum: Option<u32>) -> Result<Self, Error>
fn new(initial: u32, maximum: Option<u32>) -> Result<Self, Error>
Construct a new linear memory instance.
The memory allocated with initial number of pages specified by initial.
Minimal possible value for initial is 0 and maximum possible is 65536.
(Since maximum addressable memory is 232 = 4GiB = 65536 * 64KiB).
It is possible to limit maximum number of pages this memory instance can have by specifying
maximum. If not specified, this memory instance would be able to allocate up to 4GiB.
Allocated memory is always zeroed.