pub trait IntoCxxAsyncFuture: Sized {
type Output;
// Required method
fn fallible<Fut>(future: Fut) -> Self
where Fut: Future<Output = CxxAsyncResult<Self::Output>> + Send + 'static;
// Provided method
fn infallible<Fut>(future: Fut) -> Self
where Fut: Future<Output = Self::Output> + Send + 'static { ... }
}
Expand description
Wraps an arbitrary Rust Future in a boxed cxx-async
future so that it can be returned to C++.
You should not need to implement this manually; it’s automatically implemented by the bridge
macro.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn infallible<Fut>(future: Fut) -> Self
fn infallible<Fut>(future: Fut) -> Self
Wraps a Rust Future that directly returns the output type.
Use this when you aren’t interested in propagating errors to C++ as exceptions.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.