From ac35535283f0df3d3d03ef837b70965d305ff180 Mon Sep 17 00:00:00 2001 From: Jim Crossley Date: Wed, 14 Jul 2021 11:14:04 -0400 Subject: [PATCH] Remove some unused code Signed-off-by: Jim Crossley --- Cargo.toml | 9 +++---- src/binding/actix/server_request.rs | 38 ----------------------------- src/event/spec_version.rs | 7 ------ 3 files changed, 4 insertions(+), 50 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 652051a..147f9a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,10 +17,10 @@ categories = ["web-programming", "encoding", "data-structures"] name = "cloudevents" [features] -actix = ["actix-web", "async-trait", "lazy_static", "bytes", "futures"] -reqwest = ["reqwest-lib", "async-trait", "lazy_static", "bytes"] -rdkafka = ["rdkafka-lib", "lazy_static", "bytes", "futures"] -warp = ["warp-lib", "lazy_static", "bytes", "http", "hyper"] +actix = ["actix-web", "async-trait", "bytes", "futures"] +reqwest = ["reqwest-lib", "async-trait", "bytes"] +rdkafka = ["rdkafka-lib", "bytes", "futures"] +warp = ["warp-lib", "bytes", "http", "hyper"] [dependencies] serde = { version = "^1.0", features = ["derive"] } @@ -38,7 +38,6 @@ reqwest-lib = { version = "^0.11", default-features = false, features = ["rustls 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 } futures = { version = "^0.3", optional = true } http = { version = "0.2", optional = true } diff --git a/src/binding/actix/server_request.rs b/src/binding/actix/server_request.rs index 577bfb2..b60cfc6 100644 --- a/src/binding/actix/server_request.rs +++ b/src/binding/actix/server_request.rs @@ -95,44 +95,6 @@ impl<'a> MessageDeserializer for HttpRequestDeserializer<'a> { Encoding::UNKNOWN } } - - fn into_event(self) -> Result { - match self.encoding() { - Encoding::BINARY => BinaryDeserializer::into_event(self), - Encoding::STRUCTURED => StructuredDeserializer::into_event(self), - _ => Err(message::Error::WrongEncoding {}), - } - } - - fn deserialize_to_binary>(self, serializer: T) -> Result { - if self.encoding() == Encoding::BINARY { - return self.deserialize_binary(serializer); - } - - MessageDeserializer::into_event(self)?.deserialize_binary(serializer) - } - - fn deserialize_to_structured>( - self, - serializer: T, - ) -> Result { - if self.encoding() == Encoding::STRUCTURED { - return self.deserialize_structured(serializer); - } - - MessageDeserializer::into_event(self)?.deserialize_structured(serializer) - } - - fn deserialize_to + StructuredSerializer>( - self, - serializer: T, - ) -> Result { - if self.encoding() == Encoding::STRUCTURED { - self.deserialize_structured(serializer) - } else { - self.deserialize_binary(serializer) - } - } } /// Method to transform an incoming [`HttpRequest`] to [`Event`]. diff --git a/src/event/spec_version.rs b/src/event/spec_version.rs index 9cdab6d..b946ef7 100644 --- a/src/event/spec_version.rs +++ b/src/event/spec_version.rs @@ -32,13 +32,6 @@ impl SpecVersion { SpecVersion::V10 => &v10::ATTRIBUTE_NAMES, } } - /// Get all attribute names for all specification versions. - /// Note that the result iterator could contain duplicate entries. - pub fn all_attribute_names() -> impl Iterator { - vec![SpecVersion::V03, SpecVersion::V10] - .into_iter() - .flat_map(|s| s.attribute_names().to_owned().into_iter()) - } } impl fmt::Display for SpecVersion {