diff options
| author | Wim Looman <wim@nemo157.com> | 2018-11-06 19:47:18 +0100 |
|---|---|---|
| committer | Wim Looman <wim@nemo157.com> | 2019-01-27 22:58:59 +0100 |
| commit | 0c203965e2a5aca6750f90777003adad2b79849f (patch) | |
| tree | 995e4b20756b55f54ed877435ea3157401552fb1 /src/liballoc | |
| parent | 730b18b6e5f49091878739498793676f0c0ca28b (diff) | |
impl Generator for Pin<Box<Generator>>
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 1fd8aa98cc3..14a1242e3e5 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -882,6 +882,16 @@ impl<G: ?Sized + Generator + Unpin> Generator for Box<G> { } } +#[unstable(feature = "generator_trait", issue = "43122")] +impl<G: ?Sized + Generator> Generator for Pin<Box<G>> { + type Yield = G::Yield; + type Return = G::Return; + + fn resume(mut self: Pin<&mut Self>) -> GeneratorState<Self::Yield, Self::Return> { + G::resume((*self).as_mut()) + } +} + #[unstable(feature = "futures_api", issue = "50547")] impl<F: ?Sized + Future + Unpin> Future for Box<F> { type Output = F::Output; |
