Update examples to use new Tokio (#316)
The old `tokio-core` crate is deprecated in favour of the `tokio` crate, which also provides the new multithreaded Tokio runtime. Although `h2` is generic over the runtime, the examples do depend on `tokio`. This branch update the example code to use the new `tokio` library rather than `tokio-core`. It also updates the examples in `RustDoc`. For the most part, this was pretty trivial --- simply replacing `handle.spawn(...)` with `tokio::spawn(...)` and `core.run(...)` with `tokio::run(...)`. There were a couple of cases where error and item types from spawned futures had to be mapped to `(), ()`. Alternatively, this could have been avoided by using the single-threaded runtime and calling `block_on` instead to await the value of those futures, but I thought it was better to reduce the amount of tokio-specific code in the examples. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
@@ -62,7 +62,7 @@ serde = "1.0.0"
|
||||
serde_json = "1.0.0"
|
||||
|
||||
# Akamai example
|
||||
tokio-core = "0.1"
|
||||
tokio = "0.1.8"
|
||||
env_logger = { version = "0.5.3", default-features = false }
|
||||
rustls = "0.12"
|
||||
tokio-rustls = "0.5.0"
|
||||
|
||||
Reference in New Issue
Block a user