Skip to content

Commit

Permalink
feat(lib): add upgrade feature
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto committed Oct 1, 2023
1 parent 96d54b1 commit 569923e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ http-body = "=1.0.0-rc.2"
http-body-util = { version = "=0.1.0-rc.3", optional = true }
httparse = "1.8"
h2 = { version = "0.3.9", optional = true }
itoa = "1"
tracing = { version = "0.1", default-features = false, features = ["std"] }
pin-project-lite = "0.2.4"
tokio = { version = "1", features = ["sync"] }

# Optional

httpdate = { version = "1.0", optional = true }
itoa = { version = "1", optional = true }
libc = { version = "0.2", optional = true }
tokio = { version = "1", features = ["sync"], optional = true }
want = { version = "0.3", optional = true }

[dev-dependencies]
Expand Down Expand Up @@ -74,13 +74,16 @@ full = [
]

# HTTP versions
http1 = []
http2 = ["dep:h2"]
http1 = ["upgrade"]
http2 = ["dep:h2", "upgrade"]

# Client/Server
client = ["dep:want"]
server = ["dep:httpdate"]

# HTTP Upgrades
upgrade = ["dep:tokio", "dep:itoa"]

# C-API support (currently unstable (no semver))
ffi = ["dep:libc", "dep:http-body-util"]

Expand Down
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@
//! - `http2`: Enables HTTP/2 support.
//! - `client`: Enables the HTTP `client`.
//! - `server`: Enables the HTTP `server`.
//! - `upgrade`: Enables [HTTP Upgrades].
//!
//! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section
//! [Http Upgrades]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism
#[doc(hidden)]
pub use http;
Expand All @@ -76,7 +78,6 @@ pub mod ext;
mod mock;
pub mod rt;
pub mod service;
pub mod upgrade;

#[cfg(feature = "ffi")]
#[cfg_attr(docsrs, doc(cfg(all(feature = "ffi", hyper_unstable_ffi))))]
Expand All @@ -98,3 +99,9 @@ cfg_feature! {

pub mod server;
}

cfg_feature! {
#![feature = "upgrade"]

pub mod upgrade;
}

0 comments on commit 569923e

Please sign in to comment.