Struct rquickjs::function::Args

source ·
pub struct Args<'js> { /* private fields */ }
Expand description

Argument input for a functions

Arguments on the Rust side for calling into the JavaScript context.

Implementations§

source§

impl<'js> Args<'js>

source

pub fn new(ctx: Ctx<'js>, args: usize) -> Args<'js>

Returns a new args with space for a give number of arguments

source

pub fn new_unsized(ctx: Ctx<'js>) -> Args<'js>

Returns a new args with space for any number of arguments

source

pub fn ctx(&self) -> &Ctx<'js>

Returns the context associated with these arguments.

source

pub fn push_arg<T>(&mut self, arg: T) -> Result<(), Error>
where T: IntoJs<'js>,

Add an argument to the list.

source

pub fn push_args<T, I>(&mut self, iter: I) -> Result<(), Error>
where T: IntoJs<'js>, I: IntoIterator<Item = T>,

Add multiple arguments to the list.

source

pub fn this<T>(&mut self, this: T) -> Result<(), Error>
where T: IntoJs<'js>,

Add a this arguments.

source

pub fn take_this(&mut self) -> Value<'js>

Replace the this value with ‘Undefined’ and return the original value.

source

pub fn apply<R>(self, func: &Function<'js>) -> Result<R, Error>
where R: FromJs<'js>,

Call a function with the current set of arguments.

source

pub fn defer(self, func: Function<'js>) -> Result<(), Error>

source

pub fn construct<R>(self, constructor: &Constructor<'js>) -> Result<R, Error>
where R: FromJs<'js>,

Trait Implementations§

source§

impl Drop for Args<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'js> RefUnwindSafe for Args<'js>

§

impl<'js> !Send for Args<'js>

§

impl<'js> !Sync for Args<'js>

§

impl<'js> Unpin for Args<'js>

§

impl<'js> !UnwindSafe for Args<'js>

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.