Open
Conversation
derived Enumerations now provide their own conversion implementation from i32, so map any DecodeErrors originating from there to InvalidEncoding, and drop the manual impls that existed before. Closes: parallaxsecond#153 Signed-off-by: Fabian Grünbichler <[email protected]>
Author
|
note that I have no deeper knowledge of parsec or prost, but this is currently blocking some upgrades in Debian, so I lent a hand ;) |
Author
|
the build check fails because of unnecessary qualifications, see #151 (although that might bump MSRV too aggressively for your taste ;)) the MSRV check fails because the new prost requires a newer rustc - not sure what your policies are, so I'll leave that up to you! |
Contributor
|
Thanks for the changes. The PR looks good, just waiting for #151 to be resolved so that the CI tests can be completed. |
|
Meanwhile, prost has went to 0.13. Here's a "delta" patch for this PR: --- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,3 +14,3 @@
[build-dependencies]
-prost-build = { version = "0.12.0", optional = true }
+prost-build = { version = "0.13.0", optional = true }
@@ -23 +23 @@
-prost = "0.12.0"
+prost = "0.13.0"
--- a/src/requests/response_status.rs
+++ b/src/requests/response_status.rs
@@ -297,2 +297,12 @@
+impl From<::prost::UnknownEnumValue> for ResponseStatus {
+ fn from(err: ::prost::UnknownEnumValue) -> Self {
+ warn!(
+ "Conversion from {} to ResponseStatus::InvalidEncoding.",
+ err
+ );
+ ResponseStatus::InvalidEncoding
+ }
+}
+
impl From<::prost::DecodeError> for ResponseStatus {
--- a/src/operations_protobuf/generated_ops/mod.rs
+++ b/src/operations_protobuf/generated_ops/mod.rs
@@ -319,3 +319,3 @@
assert_eq!(
- <::prost::DecodeError as Into<ResponseStatus>>::into(Cipher::try_from(56).unwrap_err()),
+ <::prost::UnknownEnumValue as Into<ResponseStatus>>::into(Cipher::try_from(56).unwrap_err()),
ResponseStatus::InvalidEncoding
@@ -323,3 +323,3 @@
assert_eq!(
- <::prost::DecodeError as Into<ResponseStatus>>::into(Cipher::try_from(-5).unwrap_err()),
+ <::prost::UnknownEnumValue as Into<ResponseStatus>>::into(Cipher::try_from(-5).unwrap_err()),
ResponseStatus::InvalidEncoding
@@ -327,3 +327,3 @@
assert_eq!(
- <::prost::DecodeError as Into<ResponseStatus>>::into(Hash::try_from(89).unwrap_err()),
+ <::prost::UnknownEnumValue as Into<ResponseStatus>>::into(Hash::try_from(89).unwrap_err()),
ResponseStatus::InvalidEncoding
@@ -331,3 +331,3 @@
assert_eq!(
- <::prost::DecodeError as Into<ResponseStatus>>::into(Hash::try_from(-4).unwrap_err()),
+ <::prost::UnknownEnumValue as Into<ResponseStatus>>::into(Hash::try_from(-4).unwrap_err()),
ResponseStatus::InvalidEncoding
@@ -335,3 +335,3 @@
assert_eq!(
- <::prost::DecodeError as Into<ResponseStatus>>::into(EccFamily::try_from(78).unwrap_err()),
+ <::prost::UnknownEnumValue as Into<ResponseStatus>>::into(EccFamily::try_from(78).unwrap_err()),
ResponseStatus::InvalidEncoding |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
derived Enumerations now provide their own conversion implementation from i32, so map any DecodeErrors originating from there to InvalidEncoding, and drop the manual impls that existed before.
Closes: #153