diff --git a/Cargo.toml b/Cargo.toml index 1fd57f7..58e6301 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,8 @@ async-channel = "2" bytes = "^1.4.0" crc = "^3.0.1" nom = { version="^7.1.3", default-features=false, features=["alloc"] } -prost = "^0.11.9" -prost-derive = "^0.11.9" +prost = "^0.13.1" +prost-derive = "^0.13.1" rand = "^0.8.5" chrono = { version = "^0.4.26", default-features = false, features = ["clock", "std"] } futures-timer = "^3.0.2" @@ -63,7 +63,7 @@ env_logger = "^0.10.0" tokio = { version = "^1.29.1", features = ["macros", "rt-multi-thread"] } [build-dependencies] -prost-build = "^0.11.9" +prost-build = "^0.13.1" protobuf-src = { version = "1.1.0", optional = true } [features] diff --git a/src/message.rs b/src/message.rs index 0ab3a01..1e4aa2b 100644 --- a/src/message.rs +++ b/src/message.rs @@ -204,10 +204,11 @@ impl Message { type_ ); } - Err(()) => { + Err(unknown_enum) => { warn!( - "Received BaseCommand of unexpected type: {}", - self.command.r#type + "Received BaseCommand of unexpected type {}: {}", + self.command.r#type, + unknown_enum.to_string() ); } } @@ -560,53 +561,6 @@ pub mod proto { } } -impl TryFrom for base_command::Type { - type Error = (); - - #[cfg_attr(feature = "telemetry", tracing::instrument(skip_all))] - fn try_from(value: i32) -> Result { - match value { - 2 => Ok(base_command::Type::Connect), - 3 => Ok(base_command::Type::Connected), - 4 => Ok(base_command::Type::Subscribe), - 5 => Ok(base_command::Type::Producer), - 6 => Ok(base_command::Type::Send), - 7 => Ok(base_command::Type::SendReceipt), - 8 => Ok(base_command::Type::SendError), - 9 => Ok(base_command::Type::Message), - 10 => Ok(base_command::Type::Ack), - 11 => Ok(base_command::Type::Flow), - 12 => Ok(base_command::Type::Unsubscribe), - 13 => Ok(base_command::Type::Success), - 14 => Ok(base_command::Type::Error), - 15 => Ok(base_command::Type::CloseProducer), - 16 => Ok(base_command::Type::CloseConsumer), - 17 => Ok(base_command::Type::ProducerSuccess), - 18 => Ok(base_command::Type::Ping), - 19 => Ok(base_command::Type::Pong), - 20 => Ok(base_command::Type::RedeliverUnacknowledgedMessages), - 21 => Ok(base_command::Type::PartitionedMetadata), - 22 => Ok(base_command::Type::PartitionedMetadataResponse), - 23 => Ok(base_command::Type::Lookup), - 24 => Ok(base_command::Type::LookupResponse), - 25 => Ok(base_command::Type::ConsumerStats), - 26 => Ok(base_command::Type::ConsumerStatsResponse), - 27 => Ok(base_command::Type::ReachedEndOfTopic), - 28 => Ok(base_command::Type::Seek), - 29 => Ok(base_command::Type::GetLastMessageId), - 30 => Ok(base_command::Type::GetLastMessageIdResponse), - 31 => Ok(base_command::Type::ActiveConsumerChange), - 32 => Ok(base_command::Type::GetTopicsOfNamespace), - 33 => Ok(base_command::Type::GetTopicsOfNamespaceResponse), - 34 => Ok(base_command::Type::GetSchema), - 35 => Ok(base_command::Type::GetSchemaResponse), - 36 => Ok(base_command::Type::AuthChallenge), - 37 => Ok(base_command::Type::AuthResponse), - _ => Err(()), - } - } -} - impl From for ConnectionError { #[cfg_attr(feature = "telemetry", tracing::instrument(skip_all))] fn from(e: prost::EncodeError) -> Self {