Struct polkavm::CallArgs

source ·
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>

source

pub fn new(user_data: &'a mut T, export_index: ExportIndex) -> Self

Creates a new CallArgs.

source

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

source

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.

source

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.

source

pub fn args_typed<FnArgs>(&mut self, args: FnArgs) -> &mut Self
where 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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.