pub struct CallArgs<'a, T> { /* private fields */ }
Expand description
A helper struct used when calling into a function exported by the guest program.
Implementations§
source§impl<'a, T> CallArgs<'a, T>
impl<'a, T> CallArgs<'a, T>
sourcepub fn new(user_data: &'a mut T, export_index: ExportIndex) -> Self
pub fn new(user_data: &'a mut T, export_index: ExportIndex) -> Self
Creates a new CallArgs
.
sourcepub fn reset_memory_after_call(&mut self, value: bool) -> &mut Self
pub fn reset_memory_after_call(&mut self, value: bool) -> &mut Self
Decides whether the memory of the instance will be reset after the call.
Default: false
sourcepub fn reg(&mut self, reg: Reg, value: u32) -> &mut Self
pub fn reg(&mut self, reg: Reg, value: u32) -> &mut Self
Sets a given register to the given value before the call.
The default value for SP
and RA
is 0xffff0000, and for every other register it is zero.
sourcepub fn args_untyped(&mut self, args: &[u32]) -> &mut Self
pub fn args_untyped(&mut self, args: &[u32]) -> &mut Self
Sets the argument registers to the given values.
A shorthand for successively calling set_reg
with Reg::A0
, Reg::A1
, …, Reg::A5
.
Will panic if args
has more than 6 elements.
sourcepub fn args_typed<FnArgs>(&mut self, args: FnArgs) -> &mut Selfwhere
FnArgs: FuncArgs,
pub fn args_typed<FnArgs>(&mut self, args: FnArgs) -> &mut Selfwhere
FnArgs: FuncArgs,
Sets the argument registers to the given values according to the default ABI.
Auto Trait Implementations§
impl<'a, T> Freeze for CallArgs<'a, T>
impl<'a, T> RefUnwindSafe for CallArgs<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for CallArgs<'a, T>where
T: Send,
impl<'a, T> Sync for CallArgs<'a, T>where
T: Sync,
impl<'a, T> Unpin for CallArgs<'a, T>
impl<'a, T> !UnwindSafe for CallArgs<'a, 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