pub struct Sandbox {
pub input: Option<Vec<u8>>,
pub ret: Option<Vec<u8>>,
pub ext: Ext,
pub tx: Transaction,
pub cache: Rc<RefCell<dyn Frame<Memory>>>,
pub events: Vec<(Vec<[u8; 32]>, Vec<u8>)>,
pub ri: Vec<SealCall<Self>>,
}
Expand description
The runtime of ink! machine
Fields§
§input: Option<Vec<u8>>
§ret: Option<Vec<u8>>
§ext: Ext
§tx: Transaction
§cache: Rc<RefCell<dyn Frame<Memory>>>
§events: Vec<(Vec<[u8; 32]>, Vec<u8>)>
§ri: Vec<SealCall<Self>>
Implementations§
Source§impl Sandbox
impl Sandbox
pub fn deposit_event(&mut self, topics: Vec<[u8; 32]>, data: Vec<u8>)
pub fn block_number(&self) -> [u8; 32]
pub fn max_value_size(&self) -> u32
pub fn get_weight_price(&self, weight: u64) -> Vec<u8> ⓘ
Source§impl Sandbox
impl Sandbox
pub fn tombstone_deposit(&self) -> [u8; 32]
pub fn rent_allowance(&self) -> [u8; 32]
pub fn set_rent_allowance(&mut self, rent_allowence: [u8; 32])
pub fn rent_params(&self) -> Vec<u8> ⓘ
Source§impl Sandbox
impl Sandbox
Source§impl Sandbox
impl Sandbox
Sourcepub fn read_sandbox_memory(&self, ptr: u32, len: u32) -> Result<Vec<u8>>
pub fn read_sandbox_memory(&self, ptr: u32, len: u32) -> Result<Vec<u8>>
Read designated chunk from the sandbox memory.
Sourcepub fn read_sandbox_memory_into_buf(
&self,
ptr: u32,
buf: &mut [u8],
) -> Result<()>
pub fn read_sandbox_memory_into_buf( &self, ptr: u32, buf: &mut [u8], ) -> Result<()>
Read designated chunk from the sandbox into the supplied buffer
Sourcepub fn read_sandbox_memory_as<D: Decode>(
&mut self,
ptr: u32,
len: u32,
) -> Result<D>
pub fn read_sandbox_memory_as<D: Decode>( &mut self, ptr: u32, len: u32, ) -> Result<D>
Read designated chunk from the sandbox memory and attempt to decode into the specified type.
Source§impl Sandbox
impl Sandbox
Sourcepub fn get_storage(&self, key: &StorageKey) -> Result<Option<Vec<u8>>>
pub fn get_storage(&self, key: &StorageKey) -> Result<Option<Vec<u8>>>
Get storage
Sourcepub fn set_storage(&mut self, key: StorageKey, value: Vec<u8>) -> Result<()>
pub fn set_storage(&mut self, key: StorageKey, value: Vec<u8>) -> Result<()>
Get storage
Source§impl Sandbox
impl Sandbox
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sandbox
impl !RefUnwindSafe for Sandbox
impl !Send for Sandbox
impl !Sync for Sandbox
impl Unpin for Sandbox
impl !UnwindSafe for Sandbox
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.