made tests pass
This commit is contained in:
@@ -42,7 +42,7 @@ a `Future` has resolved and should be polled again.
|
|||||||
|
|
||||||
**Our Executor will look like this:**
|
**Our Executor will look like this:**
|
||||||
|
|
||||||
```rust, noplaypen
|
```rust, noplaypen, ignore
|
||||||
// Our executor takes any object which implements the `Future` trait
|
// Our executor takes any object which implements the `Future` trait
|
||||||
fn block_on<F: Future>(mut future: F) -> F::Output {
|
fn block_on<F: Future>(mut future: F) -> F::Output {
|
||||||
// the first thing we do is to construct a `Waker` which we'll pass on to
|
// the first thing we do is to construct a `Waker` which we'll pass on to
|
||||||
@@ -95,7 +95,7 @@ allow `Futures` to have self references.
|
|||||||
|
|
||||||
## The `Future` implementation
|
## The `Future` implementation
|
||||||
|
|
||||||
```rust, noplaypen
|
```rust, noplaypen, ignore
|
||||||
// This is the definition of our `Waker`. We use a regular thread-handle here.
|
// This is the definition of our `Waker`. We use a regular thread-handle here.
|
||||||
// It works but it's not a good solution. It's easy to fix though, I'll explain
|
// It works but it's not a good solution. It's easy to fix though, I'll explain
|
||||||
// after this code snippet.
|
// after this code snippet.
|
||||||
@@ -265,7 +265,7 @@ once the leaf future is ready.
|
|||||||
|
|
||||||
Our Reactor will look like this:
|
Our Reactor will look like this:
|
||||||
|
|
||||||
```rust, noplaypen
|
```rust, noplaypen, ignore
|
||||||
// This is a "fake" reactor. It does no real I/O, but that also makes our
|
// This is a "fake" reactor. It does no real I/O, but that also makes our
|
||||||
// code possible to run in the book and in the playground
|
// code possible to run in the book and in the playground
|
||||||
struct Reactor {
|
struct Reactor {
|
||||||
@@ -432,7 +432,7 @@ fn main() {
|
|||||||
reactor.lock().map(|mut r| r.close()).unwrap();
|
reactor.lock().map(|mut r| r.close()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#//// ============================ EXECUTOR ====================================
|
# // ============================ EXECUTOR ====================================
|
||||||
#
|
#
|
||||||
# // Our executor takes any object which implements the `Future` trait
|
# // Our executor takes any object which implements the `Future` trait
|
||||||
# fn block_on<F: Future>(mut future: F) -> F::Output {
|
# fn block_on<F: Future>(mut future: F) -> F::Output {
|
||||||
|
|||||||
Reference in New Issue
Block a user