Remove some unused code
Signed-off-by: Jim Crossley <jim@crossleys.org>
This commit is contained in:
parent
d18985eea9
commit
ac35535283
|
|
@ -17,10 +17,10 @@ categories = ["web-programming", "encoding", "data-structures"]
|
||||||
name = "cloudevents"
|
name = "cloudevents"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
actix = ["actix-web", "async-trait", "lazy_static", "bytes", "futures"]
|
actix = ["actix-web", "async-trait", "bytes", "futures"]
|
||||||
reqwest = ["reqwest-lib", "async-trait", "lazy_static", "bytes"]
|
reqwest = ["reqwest-lib", "async-trait", "bytes"]
|
||||||
rdkafka = ["rdkafka-lib", "lazy_static", "bytes", "futures"]
|
rdkafka = ["rdkafka-lib", "bytes", "futures"]
|
||||||
warp = ["warp-lib", "lazy_static", "bytes", "http", "hyper"]
|
warp = ["warp-lib", "bytes", "http", "hyper"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "^1.0", features = ["derive"] }
|
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" }
|
rdkafka-lib = { version = "^0.25", features = ["cmake-build"], optional = true, package = "rdkafka" }
|
||||||
warp-lib = { version = "^0.3", optional = true, package = "warp" }
|
warp-lib = { version = "^0.3", optional = true, package = "warp" }
|
||||||
async-trait = { version = "^0.1.33", optional = true }
|
async-trait = { version = "^0.1.33", optional = true }
|
||||||
lazy_static = { version = "1.4.0", optional = true }
|
|
||||||
bytes = { version = "^1.0", optional = true }
|
bytes = { version = "^1.0", optional = true }
|
||||||
futures = { version = "^0.3", optional = true }
|
futures = { version = "^0.3", optional = true }
|
||||||
http = { version = "0.2", optional = true }
|
http = { version = "0.2", optional = true }
|
||||||
|
|
|
||||||
|
|
@ -95,44 +95,6 @@ impl<'a> MessageDeserializer for HttpRequestDeserializer<'a> {
|
||||||
Encoding::UNKNOWN
|
Encoding::UNKNOWN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn into_event(self) -> Result<Event> {
|
|
||||||
match self.encoding() {
|
|
||||||
Encoding::BINARY => BinaryDeserializer::into_event(self),
|
|
||||||
Encoding::STRUCTURED => StructuredDeserializer::into_event(self),
|
|
||||||
_ => Err(message::Error::WrongEncoding {}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn deserialize_to_binary<R: Sized, T: BinarySerializer<R>>(self, serializer: T) -> Result<R> {
|
|
||||||
if self.encoding() == Encoding::BINARY {
|
|
||||||
return self.deserialize_binary(serializer);
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageDeserializer::into_event(self)?.deserialize_binary(serializer)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn deserialize_to_structured<R: Sized, T: StructuredSerializer<R>>(
|
|
||||||
self,
|
|
||||||
serializer: T,
|
|
||||||
) -> Result<R> {
|
|
||||||
if self.encoding() == Encoding::STRUCTURED {
|
|
||||||
return self.deserialize_structured(serializer);
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageDeserializer::into_event(self)?.deserialize_structured(serializer)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn deserialize_to<R: Sized, T: BinarySerializer<R> + StructuredSerializer<R>>(
|
|
||||||
self,
|
|
||||||
serializer: T,
|
|
||||||
) -> Result<R> {
|
|
||||||
if self.encoding() == Encoding::STRUCTURED {
|
|
||||||
self.deserialize_structured(serializer)
|
|
||||||
} else {
|
|
||||||
self.deserialize_binary(serializer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Method to transform an incoming [`HttpRequest`] to [`Event`].
|
/// Method to transform an incoming [`HttpRequest`] to [`Event`].
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,6 @@ impl SpecVersion {
|
||||||
SpecVersion::V10 => &v10::ATTRIBUTE_NAMES,
|
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<Item = &'static str> {
|
|
||||||
vec![SpecVersion::V03, SpecVersion::V10]
|
|
||||||
.into_iter()
|
|
||||||
.flat_map(|s| s.attribute_names().to_owned().into_iter())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for SpecVersion {
|
impl fmt::Display for SpecVersion {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue