Struct NativeArguments

Source
pub struct NativeArguments { /* private fields */ }
Expand description

Native arguments passed to a standard dart native extension function.

Manages arguments going in, and also return values going out.

Implementations§

Source§

impl NativeArguments

Source

pub unsafe fn new(args: Dart_NativeArguments) -> Self

Creates a new NativeArguments from a value given by the VM.

§Safety

args must be a pointer to a valid instance of Dart_NativeArguments. Not doing so will cause UB as the VM tries to dereference the pointer.

Source

pub fn get_native_arguments( &self, ) -> Result<(Vec<Dart_NativeArgument_Descriptor>, Vec<Dart_NativeArgument_Value>), Error>

Extracts the native arguments of the function call. This will return both the type and value of each argument. The two returned Vecs should theoretically have the same length.

Source

pub fn get_native_argument_count(&self) -> usize

Acquires the number of arguments in the NativeArguments.

Source

pub fn get_native_argument(&self, idx: usize) -> UnverifiedDartHandle

Acquires a single argument by instance in the NativeArguments. This may be an error handle. It is your job to reassure that it isn’t by calling .get_error().

Source

pub fn get_string_arg(&self, idx: usize) -> Result<String, Error>

Attempts to retrieve a string from the argument list, returning an error should it not be a string.

Source

pub fn get_bool_arg(&self, idx: usize) -> Result<bool, Error>

Attempts to retrieve a boolean from the argument list, returning an error should it not be a boolean.

Source

pub fn get_i64_arg(&self, idx: usize) -> Result<i64, Error>

Attempts to get a 64 bit signed integer from the argument list, returning an error should it not be an integer.

Source

pub fn get_f64_arg(&self, idx: usize) -> Result<f64, Error>

Attempts to get a 64 bit floating point value from the argument list, returning an error should it not be an f64.

Source

pub fn set_return(&self, val: UnverifiedDartHandle)

Sets an instance as the return value. This (and associated set_*_return functions) will be what is received on the dart end after calling the function.

Source

pub fn set_bool_return(&self, val: bool)

Sets a boolean return value. See set_return for more information.

Source

pub fn set_i64_return(&self, val: i64)

Sets an integer return value. See set_return for more information.

Source

pub fn set_f64_return(&self, val: f64)

Sets a floating point return value. See set_return for more information.

Auto Trait Implementations§

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>,

Source§

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>,

Source§

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.