W3cubDocs

/Rust

Function std::future::from_generator

pub fn from_generator<T: Generator<Yield = ()>>(    x: T) -> impl Future<Output = T::Return>
🔬 This is a nightly-only experimental API. (gen_future #50547)

Wrap a future in a generator.

This function returns a GenFuture underneath, but hides it in impl Trait to give better error messages (impl Future rather than GenFuture<[closure.....]>).

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/future/fn.from_generator.html