#[repr(transparent)]
pub struct Method<F>(pub F);
Expand description
The wrapper for method functions
The method-like functions is functions which get this
as the first argument. This wrapper allows receive this
directly as first argument and do not requires using This
for that purpose.
let func = Function::new(ctx, Method(|this: i32, factor: i32| {
this * factor
}))?;
assert_eq!(func.call::<_, i32>((This(3), 2))?, 6);
impl<'js, F, R, T, A, B, D, E, G, H> AsFunction<'js, (T, A, B, D, E, G, H), R> for Method<F> where
F: Fn(T, A, B, D, E, G, H) -> R + ParallelSend + 'static,
R: IntoJs<'js>,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
H: FromInput<'js>,
The possible range of function arguments
Post-processing the function
impl<'js, F, R, T, A, B, D, E, G> AsFunction<'js, (T, A, B, D, E, G), R> for Method<F> where
F: Fn(T, A, B, D, E, G) -> R + ParallelSend + 'static,
R: IntoJs<'js>,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
The possible range of function arguments
Post-processing the function
impl<'js, F, R, T, A, B, D, E> AsFunction<'js, (T, A, B, D, E), R> for Method<F> where
F: Fn(T, A, B, D, E) -> R + ParallelSend + 'static,
R: IntoJs<'js>,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
The possible range of function arguments
Post-processing the function
impl<'js, F, R, T, A, B, D> AsFunction<'js, (T, A, B, D), R> for Method<F> where
F: Fn(T, A, B, D) -> R + ParallelSend + 'static,
R: IntoJs<'js>,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
The possible range of function arguments
Post-processing the function
impl<'js, F, R, T, A, B> AsFunction<'js, (T, A, B), R> for Method<F> where
F: Fn(T, A, B) -> R + ParallelSend + 'static,
R: IntoJs<'js>,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
The possible range of function arguments
Post-processing the function
impl<'js, F, R, T, A> AsFunction<'js, (T, A), R> for Method<F> where
F: Fn(T, A) -> R + ParallelSend + 'static,
R: IntoJs<'js>,
T: FromJs<'js>,
A: FromInput<'js>,
The possible range of function arguments
Post-processing the function
The possible range of function arguments
Post-processing the function
The resulting type after dereferencing.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.