pub struct CallerRef<T> { /* private fields */ }
Expand description
A handle used to access the execution context, with erased lifetimes for convenience.
Can only be used from within the handler to which the original Caller
was passed.
Will panic if used incorrectly.
Implementations§
source§impl<T> CallerRef<T>
impl<T> CallerRef<T>
pub fn data(&self) -> &T
pub fn data_mut(&mut self) -> &mut T
pub fn get_reg(&self, reg: Reg) -> u32
pub fn set_reg(&mut self, reg: Reg, value: u32)
pub fn read_memory_into_slice<'slice, B>(
&self,
address: u32,
buffer: &'slice mut B,
) -> Result<&'slice mut [u8], Trap>where
B: ?Sized + AsUninitSliceMut,
pub fn read_memory_into_vec( &self, address: u32, length: u32, ) -> Result<Vec<u8>, Trap>
pub fn read_u32(&self, address: u32) -> Result<u32, Trap>
pub fn write_memory(&mut self, address: u32, data: &[u8]) -> Result<(), Trap>
pub fn gas_remaining(&self) -> Option<Gas>
pub fn consume_gas(&mut self, gas: u64)
Auto Trait Implementations§
impl<T> Freeze for CallerRef<T>
impl<T> !RefUnwindSafe for CallerRef<T>
impl<T> !Send for CallerRef<T>
impl<T> !Sync for CallerRef<T>
impl<T> Unpin for CallerRef<T>where
T: Unpin,
impl<T> !UnwindSafe for CallerRef<T>
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