Struct gdnative_async::Spawner
source · pub struct Spawner<'a, C: NativeClass, A = Varargs<'a>> { /* private fields */ }
Expand description
A helper structure for working around naming future types. See Spawner::spawn
.
Implementations§
source§impl<'a, C: NativeClass, A> Spawner<'a, C, A>
impl<'a, C: NativeClass, A> Spawner<'a, C, A>
sourcepub fn spawn<F, R>(self, f: F)where
F: FnOnce(Arc<Context>, TInstance<'_, C>, A) -> R,
R: Future<Output = Variant> + 'static,
pub fn spawn<F, R>(self, f: F)where
F: FnOnce(Arc<Context>, TInstance<'_, C>, A) -> R,
R: Future<Output = Variant> + 'static,
Consumes this Spawner
and spawns a future returned by the closure. This indirection
is necessary so that implementors of the AsyncMethod
trait do not have to name their
future types.