8000 Implement ProtobufConvert for fixed byte arrays by alekseysidorov · Pull Request #1279 · exonum/exonum · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 3 commits into from
Mar 21, 2019

Conversation

alekseysidorov
Copy link
Contributor

Overview


See: https://jira.bf.local/browse/ECR-XYZW

Definition of Done

  • There are no TODOs left in the merged code
  • Change is covered by automated tests
  • Benchmark results are attached (if applicable)
  • The coding guidelines are followed
  • Public API has proper documentation
  • Changelog is updated if needed (in case of notable or breaking changes)
  • The continuous integration build passes

@alekseysidorov alekseysidorov requested a review from dvush March 20, 2019 14:39
@codecov
Copy link
codecov bot commented Mar 20, 2019

Codecov Report

Merging #1279 into master will increase coverage by <.01%.
The diff coverage is 96.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1279      +/-   ##
==========================================
+ Coverage   92.95%   92.96%   +<.01%     
==========================================
  Files         156      156              
  Lines       23888    23921      +33     
==========================================
+ Hits        22204    22237      +33     
  Misses       1684     1684
Impacted Files Coverage Δ
exonum/src/proto/mod.rs 97.77% <100%> (+0.21%) ⬆️
exonum/src/proto/tests.rs 97.9% <95.23%> (-0.33%) ⬇️
exonum/src/storage/keys.rs 99.02% <0%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 529a46c...ef51152. Read the comment docs.

Copy link
Contributor
@dvush dvush left a 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.

}

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error> {
ensure!(pb.len() == $arr_len, "wrong array size: actual {}, expected {}", pb.len(), $arr_len);
Copy link
Contributor

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;
}
Copy link
Contributor

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,
Copy link
Contributor

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?

Copy link
Contributor

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 ? 🙃

@aleksuss aleksuss merged commit 5de31d8 into exonum:master Mar 21, 2019
@alekseysidorov alekseysidorov deleted the pb_convert_for_arrays branch May 29, 2019 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0