-
Notifications
You must be signed in to change notification settings - Fork 87
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
Introduces CRCs #98
Introduces CRCs #98
Conversation
✅ Deploy Preview for cute-starship-2d9c9b canceled.
|
A `crc` feature has been added that brings in the `crc` crate and a new `CrcModifier` flavour. This modifier flavour is similar to the COBS implementation in how it wraps another flavour.
9f7539e
to
dc9dece
Compare
Convenience functions for serde usage
optional = true | ||
|
||
[dependencies.paste] | ||
version = "1.0.12" |
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.
For some help with our declarative macros.
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.
Would it make sense to make this optional and gate it on the crc feature?
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.
We could, although perhaps that adds a little complexity in case we need it elsewhere?
Alternatively, let's get rid of the macros and the need for this. :-)
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.
Commit 2c9ed55 makes the paste
crate optional and includes it when use-crc
is enabled.
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.
Overall looks good to me! I don't love the use of macros, but I'll play around with this in a follow-on PR before releasing.
One minor comment, then should be ready to merge.
Thanks!
I don't like the macros either, but I just couldn't get the
Lemme know if you insist on paste being removed as per my reply to your comment.
My pleasure. This library was great to work on, as well as use! Thanks for providing it! |
The paste crate is included now only if `use-crc` feature is enabled. This may help improve build performance where CRCs are not required.
This uses the correct digest sizes, and adds a test for a random CRC8 variant.
Hey @huntc, I think e437a16 was a legitimate bug, let me know if you think it looks good now. I did try to reduce the size of the macro (so far: only on deser), but I don't think it's actually an improvement, just "not great in other ways": huntc#1 I'm inclined to merge this as-is now, once I have your ACK on that last commit. |
Part of the challenge in my generic approach is: mrhooray/crc-rs#79. |
Thanks James. Sorry about the bug there. Good catch! The issues you found with generalising the width appear to be the same I had. I’d say the main aspect of this PR is that its public API is maintainable going forward. If the underlying CRC lib was to change then I think we should remain in a good place. |
A
crc
feature has been added that brings in thecrc
crate and a newCrcModifier
flavour. This modifier flavour is similar to the COBS implementation in how it wraps another flavour.Convenience functions for serde are also introduced.
TODO: