Until this commit, servers have required that `Service` and their `Future` to be `Send`, since the server needs to spawn some internal tasks to an executor, and by default, that is `tokio::spawn`, which could be spawning to a threadpool. This was true even if the user were certain there was no threadpool involved, and was instead using a different single-threaded runtime, like `tokio::runtime::current_thread`. This changes makes all the server pieces generic over an `E`, which is essentially `Executor<PrivateTypes<Server::Future>>`. There's a new set of internal traits, `H2Exec` and `NewSvcExec`, which allow for the type signature to only show the generics that the user is providing. The traits cannot be implemented explicitly, but there are blanket implementations for `E: Executor<SpecificType>`. If the user provides their own executor, it simply needs to have a generic `impl<F> Executor<F> for MyExec`. That impl can have bounds deciding whether to require `F: Send`. If the executor does require `Send`, and the `Service` futures are `!Send`, there will be compiler errors. To prevent a breaking change, all the types that gained the `E` generic have a default type set, which is the original `tokio::spawn` executor.
165 lines
3.1 KiB
TOML
165 lines
3.1 KiB
TOML
[package]
|
|
name = "hyper"
|
|
version = "0.12.12" # don't forget to update html_root_url
|
|
description = "A fast and correct HTTP library."
|
|
readme = "README.md"
|
|
homepage = "https://hyper.rs"
|
|
documentation = "https://docs.rs/hyper"
|
|
repository = "https://github.com/hyperium/hyper"
|
|
license = "MIT"
|
|
authors = ["Sean McArthur <sean@seanmonstar.com>"]
|
|
keywords = ["http", "hyper", "hyperium"]
|
|
categories = ["network-programming", "web-programming::http-client", "web-programming::http-server"]
|
|
|
|
include = [
|
|
"Cargo.toml",
|
|
"LICENSE",
|
|
"src/**/*"
|
|
]
|
|
|
|
[dependencies]
|
|
bytes = "0.4.4"
|
|
futures = "0.1.21"
|
|
futures-cpupool = { version = "0.1.6", optional = true }
|
|
http = "0.1.13"
|
|
httparse = "1.0"
|
|
h2 = "0.1.10"
|
|
iovec = "0.1"
|
|
itoa = "0.4.1"
|
|
log = "0.4"
|
|
net2 = { version = "0.2.32", optional = true }
|
|
time = "0.1"
|
|
tokio = { version = "0.1.7", optional = true }
|
|
tokio-executor = { version = "0.1.0", optional = true }
|
|
tokio-io = "0.1"
|
|
tokio-reactor = { version = "0.1", optional = true }
|
|
tokio-tcp = { version = "0.1", optional = true }
|
|
tokio-timer = { version = "0.2", optional = true }
|
|
want = "0.0.6"
|
|
|
|
[dev-dependencies]
|
|
futures-timer = "0.1"
|
|
num_cpus = "1.0"
|
|
pretty_env_logger = "0.2.0"
|
|
spmc = "0.2"
|
|
url = "1.0"
|
|
tokio-fs = "0.1"
|
|
tokio-mockstream = "1.1.0"
|
|
serde = "1.0"
|
|
serde_derive = "1.0"
|
|
serde_json = "1.0"
|
|
|
|
[features]
|
|
default = [
|
|
"__internal_flaky_tests",
|
|
"runtime",
|
|
]
|
|
runtime = [
|
|
"futures-cpupool",
|
|
"net2",
|
|
"tokio",
|
|
"tokio-executor",
|
|
"tokio-reactor",
|
|
"tokio-tcp",
|
|
"tokio-timer",
|
|
]
|
|
nightly = []
|
|
__internal_flaky_tests = []
|
|
|
|
[profile.release]
|
|
codegen-units = 1
|
|
incremental = false
|
|
|
|
[profile.bench]
|
|
codegen-units = 1
|
|
incremental = false
|
|
|
|
[[example]]
|
|
name = "client"
|
|
path = "examples/client.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "client_json"
|
|
path = "examples/client_json.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "echo"
|
|
path = "examples/echo.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "hello"
|
|
path = "examples/hello.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "multi_server"
|
|
path = "examples/multi_server.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "params"
|
|
path = "examples/params.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "proxy"
|
|
path = "examples/proxy.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "send_file"
|
|
path = "examples/send_file.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "single_threaded"
|
|
path = "examples/single_threaded.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "state"
|
|
path = "examples/state.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[example]]
|
|
name = "upgrades"
|
|
path = "examples/upgrades.rs"
|
|
required-features = ["runtime"]
|
|
|
|
|
|
[[example]]
|
|
name = "web_api"
|
|
path = "examples/web_api.rs"
|
|
required-features = ["runtime"]
|
|
|
|
|
|
[[bench]]
|
|
name = "end_to_end"
|
|
path = "benches/end_to_end.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[bench]]
|
|
name = "server"
|
|
path = "benches/server.rs"
|
|
required-features = ["runtime"]
|
|
|
|
|
|
[[test]]
|
|
name = "client"
|
|
path = "tests/client.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[test]]
|
|
name = "integration"
|
|
path = "tests/integration.rs"
|
|
required-features = ["runtime"]
|
|
|
|
[[test]]
|
|
name = "server"
|
|
path = "tests/server.rs"
|
|
required-features = ["runtime"]
|
|
|