Fix pinning example

The existing `AsyncFuture` example wouldn't compile due to missing the Future trait's required `Output` type and not marking `self` as mutable (required to update `AsyncFuture::state`).
This commit is contained in:
David Coles 2019-11-13 21:12:47 -08:00 committed by Taylor Cramer
parent a276e7ebdc
commit 799fded3c8
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,9 @@ enum State {
}
impl Future for AsyncFuture {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
loop {
match self.state {
State::AwaitingFutOne => match self.fut_one.poll(..) {