added main example

This commit is contained in:
Carl Fredrik Samson
2020-01-30 23:57:02 +01:00
parent 59f00d69e9
commit a84faa9f3f
15 changed files with 394 additions and 259 deletions

View File

@@ -1,6 +1,6 @@
# Implementing our own Future
```rust
use std::{
future::Future, pin::Pin, sync::{mpsc::{channel, Sender}, Arc, Mutex},
task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
@@ -192,4 +192,14 @@ impl Drop for Reactor {
self.handle.take().map(|h| h.join().unwrap()).unwrap();
}
}
```
```
> Unfortunately there seems to be a bug which causes a compiler error when
> trying to run code including the `async` keyword in Mdbook. I've filed an [issue
> for it][mdbook_issue] Until that is
> resolved you can test and run it in [the playground][playground_example].
[playground_example]:https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=ca43dba55c6e3838c5494de45875677f
[mdbook_issue]: https://github.com/rust-lang/mdBook/issues/1134