Skip to main content

RustFunction

Struct RustFunction 

Source
pub struct RustFunction<'js>(pub Box<dyn RustFunc<'js> + 'js>);
Expand description

The class used for wrapping closures, rquickjs implements callbacks by creating an instances of this class.

Tuple Fields§

§0: Box<dyn RustFunc<'js> + 'js>

Trait Implementations§

Source§

impl<'js> JsClass<'js> for RustFunction<'js>

Source§

const NAME: &'static str = "RustFunction"

The name the constructor has in JavaScript
Source§

const KIND: ClassKind = ClassKind::Callable

The kind of this class (plain, callable, or exotic).
Source§

type Mutable = Readable

Can the type be mutated while a JavaScript value. Read more
Source§

fn prototype(ctx: &Ctx<'js>) -> Result<Option<Object<'js>>>

Returns the class prototype,
Source§

fn constructor(_ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>

Returns a predefined constructor for this specific class type if there is one.
Source§

fn call<'a>( this: &JsCell<'js, Self>, params: Params<'a, 'js>, ) -> Result<Value<'js>>

The function which will be called if Self::KIND is ClassKind::Callable and an object with this class is called as if it is a function.
Source§

fn exotic_get_property( this: &JsCell<'js, Self>, ctx: &Ctx<'js>, _atom: Atom<'js>, _receiver: Value<'js>, ) -> Result<Value<'js>>

The function which will be called if a get property is performed on an object with this class
Source§

fn exotic_set_property( this: &JsCell<'js, Self>, _ctx: &Ctx<'js>, _atom: Atom<'js>, _receiver: Value<'js>, _value: Value<'js>, ) -> Result<bool>

The function which will be called if a set property is performed on an object with this class
Source§

fn exotic_delete_property( this: &JsCell<'js, Self>, _ctx: &Ctx<'js>, _atom: Atom<'js>, ) -> Result<bool>

The function which will be called if a delete property is performed on an object with this class
Source§

fn exotic_has_property( this: &JsCell<'js, Self>, _ctx: &Ctx<'js>, _atom: Atom<'js>, ) -> Result<bool>

The function which will be called if has property or similar is called on an object with this class
Source§

fn exotic_get_own_property( this: &JsCell<'js, Self>, _ctx: &Ctx<'js>, _atom: Atom<'js>, ) -> Result<Option<PropertyDescriptor<'js>>>

Called to get the own property descriptor for a given property name. Read more
Source§

fn exotic_get_own_property_names( this: &JsCell<'js, Self>, _ctx: &Ctx<'js>, ) -> Result<Vec<PropertyName<'js>>>

Called to enumerate the own property names of this object. Read more
Source§

impl<'js> JsLifetime<'js> for RustFunction<'js>

Source§

type Changed<'to> = RustFunction<'to>

The target which has the same type as a Self but with another lifetime 't
Source§

impl<'js> Trace<'js> for RustFunction<'js>

Source§

fn trace<'a>(&self, _tracer: Tracer<'a, 'js>)

Auto Trait Implementations§

§

impl<'js> Freeze for RustFunction<'js>

§

impl<'js> !RefUnwindSafe for RustFunction<'js>

§

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

§

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

§

impl<'js> Unpin for RustFunction<'js>

§

impl<'js> UnsafeUnpin for RustFunction<'js>

§

impl<'js> !UnwindSafe for RustFunction<'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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<T> ParallelSend for T