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§fn prototype(ctx: &Ctx<'js>) -> Result<Option<Object<'js>>, Error>
fn prototype(ctx: &Ctx<'js>) -> Result<Option<Object<'js>>, Error>
Returns the class prototype,
Source§fn constructor(_ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>, Error>
fn constructor(_ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>, Error>
Returns a predefined constructor for this specific class type if there is one.
Source§fn call<'a>(
this: &JsCell<'js, RustFunction<'js>>,
params: Params<'a, 'js>,
) -> Result<Value<'js>, Error>
fn call<'a>( this: &JsCell<'js, RustFunction<'js>>, params: Params<'a, 'js>, ) -> Result<Value<'js>, Error>
The function which will be called if
Self::CALLABLE is true and an an object with this
class is called as if it is a function.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> !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