Struct metacall::MetacallFuture
source · #[repr(C)]pub struct MetacallFuture { /* private fields */ }
Expand description
Represents MetacallFuture. Keep in mind that it’s not supported to pass a future as an argument. Usage example: …
use metacall::{MetacallValue, MetacallFuture, metacall};
fn resolve(result: impl MetacallValue, data: impl MetacallValue) {
println!("Resolve:: result: {:#?}, data: {:#?}", result, data);
}
fn reject(result: impl MetacallValue, data: impl MetacallValue) {
println!("Reject:: result: {:#?}, data: {:#?}", result, data);
}
let future = metacall::<MetacallFuture>("async_function", [1]).unwrap();
future.then(resolve).catch(reject).await_fut();
Implementations§
source§impl MetacallFuture
impl MetacallFuture
sourcepub fn then(self, resolve: MetacallFutureHandler) -> Self
pub fn then(self, resolve: MetacallFutureHandler) -> Self
Adds a resolve callback.
sourcepub fn catch(self, reject: MetacallFutureHandler) -> Self
pub fn catch(self, reject: MetacallFutureHandler) -> Self
Adds a reject callback.
sourcepub fn data(self, data: impl MetacallValue) -> Self
pub fn data(self, data: impl MetacallValue) -> Self
Adds data.
Trait Implementations§
source§impl Clone for MetacallFuture
impl Clone for MetacallFuture
source§impl Debug for MetacallFuture
impl Debug for MetacallFuture
source§impl Drop for MetacallFuture
impl Drop for MetacallFuture
impl MetacallValue for MetacallFuture
Equivalent to Metacall future type.
impl Send for MetacallFuture
impl Sync for MetacallFuture
Auto Trait Implementations§
impl !RefUnwindSafe for MetacallFuture
impl Unpin for MetacallFuture
impl !UnwindSafe for MetacallFuture
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