Struct rquickjs_core::prelude::Async
source · #[repr(transparent)]pub struct Async<F>(pub F);
Available on crate feature
futures
only.Expand description
The wrapper for async functons
This type wraps returned future into Promised
// Inorder to conver to a javascript promise the future must return a `Result`.
async fn my_func() -> Result<()> { Ok(()) }
let func = Function::new(ctx, Async(my_func));
Tuple Fields§
§0: F
Trait Implementations§
source§impl<'js, F, Fut, R> AsFunction<'js, (), Promised<R>> for Async<F>where
F: Fn() -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
impl<'js, F, Fut, R> AsFunction<'js, (), Promised<R>> for Async<F>where F: Fn() -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js,
source§impl<'js, F, Fut, R> AsFunction<'js, (), Promised<R>> for Async<MutFn<F>>where
F: FnMut() -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
impl<'js, F, Fut, R> AsFunction<'js, (), Promised<R>> for Async<MutFn<F>>where F: FnMut() -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js,
source§impl<'js, F, Fut, R> AsFunction<'js, (), Promised<R>> for Async<OnceFn<F>>where
F: FnOnce() -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
impl<'js, F, Fut, R> AsFunction<'js, (), Promised<R>> for Async<OnceFn<F>>where F: FnOnce() -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js,
source§impl<'js, F, Fut, R, A> AsFunction<'js, (A,), Promised<R>> for Async<F>where
F: Fn(A) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
impl<'js, F, Fut, R, A> AsFunction<'js, (A,), Promised<R>> for Async<F>where F: Fn(A) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>,
source§impl<'js, F, Fut, R, A> AsFunction<'js, (A,), Promised<R>> for Async<MutFn<F>>where
F: FnMut(A) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
impl<'js, F, Fut, R, A> AsFunction<'js, (A,), Promised<R>> for Async<MutFn<F>>where F: FnMut(A) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>,
source§impl<'js, F, Fut, R, A> AsFunction<'js, (A,), Promised<R>> for Async<OnceFn<F>>where
F: FnOnce(A) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
impl<'js, F, Fut, R, A> AsFunction<'js, (A,), Promised<R>> for Async<OnceFn<F>>where F: FnOnce(A) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B> AsFunction<'js, (A, B), Promised<R>> for Async<F>where
F: Fn(A, B) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
impl<'js, F, Fut, R, A, B> AsFunction<'js, (A, B), Promised<R>> for Async<F>where F: Fn(A, B) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B> AsFunction<'js, (A, B), Promised<R>> for Async<MutFn<F>>where
F: FnMut(A, B) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
impl<'js, F, Fut, R, A, B> AsFunction<'js, (A, B), Promised<R>> for Async<MutFn<F>>where F: FnMut(A, B) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B> AsFunction<'js, (A, B), Promised<R>> for Async<OnceFn<F>>where
F: FnOnce(A, B) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
impl<'js, F, Fut, R, A, B> AsFunction<'js, (A, B), Promised<R>> for Async<OnceFn<F>>where F: FnOnce(A, B) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D> AsFunction<'js, (A, B, D), Promised<R>> for Async<F>where
F: Fn(A, B, D) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D> AsFunction<'js, (A, B, D), Promised<R>> for Async<F>where F: Fn(A, B, D) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D> AsFunction<'js, (A, B, D), Promised<R>> for Async<MutFn<F>>where
F: FnMut(A, B, D) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D> AsFunction<'js, (A, B, D), Promised<R>> for Async<MutFn<F>>where F: FnMut(A, B, D) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D> AsFunction<'js, (A, B, D), Promised<R>> for Async<OnceFn<F>>where
F: FnOnce(A, B, D) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D> AsFunction<'js, (A, B, D), Promised<R>> for Async<OnceFn<F>>where F: FnOnce(A, B, D) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D, E> AsFunction<'js, (A, B, D, E), Promised<R>> for Async<F>where
F: Fn(A, B, D, E) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D, E> AsFunction<'js, (A, B, D, E), Promised<R>> for Async<F>where F: Fn(A, B, D, E) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D, E> AsFunction<'js, (A, B, D, E), Promised<R>> for Async<MutFn<F>>where
F: FnMut(A, B, D, E) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D, E> AsFunction<'js, (A, B, D, E), Promised<R>> for Async<MutFn<F>>where F: FnMut(A, B, D, E) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D, E> AsFunction<'js, (A, B, D, E), Promised<R>> for Async<OnceFn<F>>where
F: FnOnce(A, B, D, E) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D, E> AsFunction<'js, (A, B, D, E), Promised<R>> for Async<OnceFn<F>>where F: FnOnce(A, B, D, E) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D, E, G> AsFunction<'js, (A, B, D, E, G), Promised<R>> for Async<F>where
F: Fn(A, B, D, E, G) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D, E, G> AsFunction<'js, (A, B, D, E, G), Promised<R>> for Async<F>where F: Fn(A, B, D, E, G) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>, G: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D, E, G> AsFunction<'js, (A, B, D, E, G), Promised<R>> for Async<MutFn<F>>where
F: FnMut(A, B, D, E, G) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D, E, G> AsFunction<'js, (A, B, D, E, G), Promised<R>> for Async<MutFn<F>>where F: FnMut(A, B, D, E, G) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>, G: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D, E, G> AsFunction<'js, (A, B, D, E, G), Promised<R>> for Async<OnceFn<F>>where
F: FnOnce(A, B, D, E, G) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D, E, G> AsFunction<'js, (A, B, D, E, G), Promised<R>> for Async<OnceFn<F>>where F: FnOnce(A, B, D, E, G) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>, G: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D, E, G, H> AsFunction<'js, (A, B, D, E, G, H), Promised<R>> for Async<F>where
F: Fn(A, B, D, E, G, H) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
H: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D, E, G, H> AsFunction<'js, (A, B, D, E, G, H), Promised<R>> for Async<F>where F: Fn(A, B, D, E, G, H) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>, G: FromInput<'js>, H: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D, E, G, H> AsFunction<'js, (A, B, D, E, G, H), Promised<R>> for Async<MutFn<F>>where
F: FnMut(A, B, D, E, G, H) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
H: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D, E, G, H> AsFunction<'js, (A, B, D, E, G, H), Promised<R>> for Async<MutFn<F>>where F: FnMut(A, B, D, E, G, H) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>, G: FromInput<'js>, H: FromInput<'js>,
source§impl<'js, F, Fut, R, A, B, D, E, G, H> AsFunction<'js, (A, B, D, E, G, H), Promised<R>> for Async<OnceFn<F>>where
F: FnOnce(A, B, D, E, G, H) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
H: FromInput<'js>,
impl<'js, F, Fut, R, A, B, D, E, G, H> AsFunction<'js, (A, B, D, E, G, H), Promised<R>> for Async<OnceFn<F>>where F: FnOnce(A, B, D, E, G, H) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>, G: FromInput<'js>, H: FromInput<'js>,
source§impl<'js, F, Fut, R, T> AsFunction<'js, (T,), Promised<R>> for Async<Method<F>>where
F: Fn(T) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
T: FromJs<'js>,
impl<'js, F, Fut, R, T> AsFunction<'js, (T,), Promised<R>> for Async<Method<F>>where F: Fn(T) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, T: FromJs<'js>,
source§impl<'js, F, Fut, R, T, A> AsFunction<'js, (T, A), Promised<R>> for Async<Method<F>>where
F: Fn(T, A) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
T: FromJs<'js>,
A: FromInput<'js>,
impl<'js, F, Fut, R, T, A> AsFunction<'js, (T, A), Promised<R>> for Async<Method<F>>where F: Fn(T, A) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, T: FromJs<'js>, A: FromInput<'js>,
source§impl<'js, F, Fut, R, T, A, B> AsFunction<'js, (T, A, B), Promised<R>> for Async<Method<F>>where
F: Fn(T, A, B) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
impl<'js, F, Fut, R, T, A, B> AsFunction<'js, (T, A, B), Promised<R>> for Async<Method<F>>where F: Fn(T, A, B) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, T: FromJs<'js>, A: FromInput<'js>, B: FromInput<'js>,
source§impl<'js, F, Fut, R, T, A, B, D> AsFunction<'js, (T, A, B, D), Promised<R>> for Async<Method<F>>where
F: Fn(T, A, B, D) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
impl<'js, F, Fut, R, T, A, B, D> AsFunction<'js, (T, A, B, D), Promised<R>> for Async<Method<F>>where F: Fn(T, A, B, D) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, T: FromJs<'js>, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>,
source§impl<'js, F, Fut, R, T, A, B, D, E> AsFunction<'js, (T, A, B, D, E), Promised<R>> for Async<Method<F>>where
F: Fn(T, A, B, D, E) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
impl<'js, F, Fut, R, T, A, B, D, E> AsFunction<'js, (T, A, B, D, E), Promised<R>> for Async<Method<F>>where F: Fn(T, A, B, D, E) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, T: FromJs<'js>, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>,
source§impl<'js, F, Fut, R, T, A, B, D, E, G> AsFunction<'js, (T, A, B, D, E, G), Promised<R>> for Async<Method<F>>where
F: Fn(T, A, B, D, E, G) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
impl<'js, F, Fut, R, T, A, B, D, E, G> AsFunction<'js, (T, A, B, D, E, G), Promised<R>> for Async<Method<F>>where F: Fn(T, A, B, D, E, G) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, T: FromJs<'js>, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>, G: FromInput<'js>,
source§impl<'js, F, Fut, R, T, A, B, D, E, G, H> AsFunction<'js, (T, A, B, D, E, G, H), Promised<R>> for Async<Method<F>>where
F: Fn(T, A, B, D, E, G, H) -> Fut + 'js,
Fut: Future<Output = Result<R>> + 'js,
R: IntoJs<'js> + 'js,
T: FromJs<'js>,
A: FromInput<'js>,
B: FromInput<'js>,
D: FromInput<'js>,
E: FromInput<'js>,
G: FromInput<'js>,
H: FromInput<'js>,
impl<'js, F, Fut, R, T, A, B, D, E, G, H> AsFunction<'js, (T, A, B, D, E, G, H), Promised<R>> for Async<Method<F>>where F: Fn(T, A, B, D, E, G, H) -> Fut + 'js, Fut: Future<Output = Result<R>> + 'js, R: IntoJs<'js> + 'js, T: FromJs<'js>, A: FromInput<'js>, B: FromInput<'js>, D: FromInput<'js>, E: FromInput<'js>, G: FromInput<'js>, H: FromInput<'js>,
Auto Trait Implementations§
impl<F> RefUnwindSafe for Async<F>where F: RefUnwindSafe,
impl<F> Send for Async<F>where F: Send,
impl<F> Sync for Async<F>where F: Sync,
impl<F> Unpin for Async<F>where F: Unpin,
impl<F> UnwindSafe for Async<F>where F: UnwindSafe,
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