-
Notifications
You must be signed in to change notification settings - Fork 245
Implement ProtobufConvert for fixed byte arrays #1279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1279 +/- ##
==========================================
+ Coverage 92.95% 92.96% +<.01%
==========================================
Files 156 156
Lines 23888 23921 +33
==========================================
+ Hits 22204 22237 +33
Misses 1684 1684
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, great idea. // I left only nitpicks.
I can imagine one could do something similar for [T; N], T = ProtobufConvert(similar to Vec) for repeated fields in the future.
exonum/src/proto/mod.rs
Outdated
} | ||
|
||
fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error> { | ||
ensure!(pb.len() == $arr_len, "wrong array size: actual {}, expected {}", pb.len(), $arr_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line is too long.
bytes fixed_array_8 = 1; | ||
bytes fixed_array_16 = 2; | ||
bytes fixed_array_32 = 3; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'/n/ ?
} | ||
|
||
impl_protobuf_convert_fixed_byte_array! { | ||
8, 16, 24, 32, 40, 48, 56, 64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why this numbers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most common lengths of arrays ? 🙃
Overview
See: https://jira.bf.local/browse/ECR-XYZW
Definition of Done