diff --git a/.github/workflows/rust_tests.yml b/.github/workflows/rust_tests.yml index 3657455..a795d65 100644 --- a/.github/workflows/rust_tests.yml +++ b/.github/workflows/rust_tests.yml @@ -97,7 +97,7 @@ jobs: with: command: build toolchain: ${{ matrix.toolchain }} - args: --target wasm32-unknown-unknown --features reqwest-binding + args: --target wasm32-unknown-unknown --features reqwest # Build examples - uses: actions-rs/cargo@v1 diff --git a/Cargo.toml b/Cargo.toml index 4466127..c2132bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,10 +17,10 @@ categories = ["web-programming", "encoding", "data-structures"] name = "cloudevents" [features] -actix-binding = ["actix-web", "async-trait", "lazy_static", "bytes", "futures"] -reqwest-binding = ["reqwest", "async-trait", "lazy_static", "bytes"] -rdkafka-binding = ["rdkafka", "lazy_static", "bytes"] -warp-binding = ["warp", "lazy_static", "bytes", "http", "hyper"] +actix = ["actix-web", "async-trait", "lazy_static", "bytes", "futures"] +reqwest = ["reqwest-lib", "async-trait", "lazy_static", "bytes"] +rdkafka = ["rdkafka-lib", "lazy_static", "bytes"] +warp = ["warp-lib", "lazy_static", "bytes", "http", "hyper"] [dependencies] serde = { version = "^1.0", features = ["derive"] } @@ -34,9 +34,9 @@ bitflags = "^1.2" # runtime optional deps actix-web = { version = "^3", default-features = false, optional = true } -reqwest = { version = "^0.11", default-features = false, features = ["rustls-tls"], optional = true } -rdkafka = { version = "^0.25", features = ["cmake-build"], optional = true } -warp = { version = "^0.3", optional = true } +reqwest-lib = { version = "^0.11", default-features = false, features = ["rustls-tls"], optional = true, package = "reqwest" } +rdkafka-lib = { version = "^0.25", features = ["cmake-build"], optional = true, package = "rdkafka" } +warp-lib = { version = "^0.3", optional = true, package = "warp" } async-trait = { version = "^0.1.33", optional = true } lazy_static = { version = "1.4.0", optional = true } bytes = { version = "^1.0", optional = true } diff --git a/README.md b/README.md index b6529cc..c3e8362 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,10 @@ The core modules include definitions for the `Event` and mechanism to support various Protocol Bindings, each of which is enabled by a specific [feature flag]: -* `actix-binding`: Integration with [actix](https://actix.rs/). -* `warp-binding`: Integration with [warp](https://github.com/seanmonstar/warp/). -* `reqwest-binding`: Integration with [reqwest](https://github.com/seanmonstar/reqwest). -* `rdkafka-binding`: Integration with [rdkafka](https://fede1024.github.io/rust-rdkafka). +* `actix`: Integration with [actix](https://actix.rs/). +* `warp`: Integration with [warp](https://github.com/seanmonstar/warp/). +* `reqwest`: Integration with [reqwest](https://github.com/seanmonstar/reqwest). +* `rdkafka`: Integration with [rdkafka](https://fede1024.github.io/rust-rdkafka). This crate is continuously tested to work with GNU libc, WASM and musl toolchains. @@ -40,7 +40,7 @@ enabling your Protocol Binding of choice: ```toml [dependencies] -cloudevents-sdk = { version = "0.3.1", features = ["actix-binding"] } +cloudevents-sdk = { version = "0.3.1", features = ["actix"] } ``` Now you can start creating events: diff --git a/example-projects/actix-web-example/Cargo.toml b/example-projects/actix-web-example/Cargo.toml index 71b03eb..8696596 100644 --- a/example-projects/actix-web-example/Cargo.toml +++ b/example-projects/actix-web-example/Cargo.toml @@ -5,12 +5,9 @@ authors = ["Francesco Guardiani "] edition = "2018" [dependencies] -cloudevents-sdk = { path = "../..", features = ["actix-binding"] } +cloudevents-sdk = { path = "../..", features = ["actix"] } actix-web = "^3" actix-cors = "^0.5" -lazy_static = "1.4.0" -bytes = "^0.5" -futures = "^0.3" serde_json = "^1.0" url = { version = "^2.1" } env_logger = "0.7.1" diff --git a/example-projects/rdkafka-example/Cargo.toml b/example-projects/rdkafka-example/Cargo.toml index ca1a870..b67753d 100644 --- a/example-projects/rdkafka-example/Cargo.toml +++ b/example-projects/rdkafka-example/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] async-trait = "^0.1.33" -cloudevents-sdk = { path = "../..", features = ["rdkafka-binding"] } +cloudevents-sdk = { path = "../..", features = ["rdkafka"] } lazy_static = "1.4.0" bytes = "^1.0" url = { version = "^2.1", features = ["serde"] } diff --git a/example-projects/reqwest-wasm-example/Cargo.toml b/example-projects/reqwest-wasm-example/Cargo.toml index ae4d24d..19356d9 100644 --- a/example-projects/reqwest-wasm-example/Cargo.toml +++ b/example-projects/reqwest-wasm-example/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib"] [dependencies] reqwest = "^0.11" -cloudevents-sdk = { path = "../..", features = ["reqwest-binding"] } +cloudevents-sdk = { path = "../..", features = ["reqwest"] } url = { version = "^2.1" } web-sys = { version = "0.3.39", features = ["Window", "Location"] } wasm-bindgen-futures = "0.4.12" diff --git a/example-projects/warp-example/Cargo.toml b/example-projects/warp-example/Cargo.toml index eaf7742..b2830fa 100644 --- a/example-projects/warp-example/Cargo.toml +++ b/example-projects/warp-example/Cargo.toml @@ -7,6 +7,6 @@ categories = ["web-programming", "encoding"] license-file = "../LICENSE" [dependencies] -cloudevents-sdk = { path = "../..", features = ["warp-binding"] } +cloudevents-sdk = { path = "../..", features = ["warp"] } warp = "^0.3" tokio = { version = "^1.0", features = ["full"] } diff --git a/src/binding/mod.rs b/src/binding/mod.rs index 7323f41..67247af 100644 --- a/src/binding/mod.rs +++ b/src/binding/mod.rs @@ -1,10 +1,10 @@ //! Provides protocol binding implementations for [`Event`]. -#[cfg(feature = "actix-binding")] +#[cfg(feature = "actix")] pub mod actix; -#[cfg(feature = "rdkafka-binding")] +#[cfg(feature = "rdkafka")] pub mod rdkafka; -#[cfg(feature = "reqwest-binding")] +#[cfg(feature = "reqwest")] pub mod reqwest; -#[cfg(feature = "warp-binding")] +#[cfg(feature = "warp")] pub mod warp; diff --git a/src/lib.rs b/src/lib.rs index 42477b2..75f7fda 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,7 @@ //! Cloudevents uses a set of [feature flags] to conditionally compile //! only the module associated with the Protocol Binding you need: //! -//! - `actix-binding`: Enables the [actix] protocol binding module. This +//! - `actix`: Enables the [actix] protocol binding module. This //! extends the [`actix_web::HttpRequest`] with a //! [`to_event`](actix::HttpRequestExt::to_event) function, the //! [`actix_web::dev::HttpResponseBuilder`] with an @@ -44,9 +44,9 @@ //! and implementations for [`actix_web::FromRequest`] and //! [`actix_web::Responder`] in order to take advantage of actix-web's //! [Extractors] and [Responders] -//! - `reqwest-binding`: Enables the [reqwest] protocol binding module. -//! - `warp-binding`: Enables the [warp] protocol binding module. -//! - `rdkafka-binding`: Enables the [rdkafka] protocol binding module to +//! - `reqwest`: Enables the [reqwest] protocol binding module. +//! - `warp`: Enables the [warp] protocol binding module. +//! - `rdkafka`: Enables the [rdkafka] protocol binding module to //! seamlessly consume/produce cloudevents within Kafka messages. //! //! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section