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>
impl<'js> JsClass<'js> for RustFunction<'js>
Source§const KIND: ClassKind = ClassKind::Callable
const KIND: ClassKind = ClassKind::Callable
The kind of this class (plain, callable, or exotic).
Source§fn constructor(_ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>
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>>
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>>
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>
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>
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>
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>>>
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>>>
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>
impl<'js> JsLifetime<'js> for RustFunction<'js>
Source§type Changed<'to> = RustFunction<'to>
type Changed<'to> = RustFunction<'to>
The target which has the same type as a
Self but with another lifetime 'tAuto 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> 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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