-
Notifications
You must be signed in to change notification settings - Fork 29
feat: add function to decode an entire slice #23
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
Changes from 4 commits
38f26bb
75501ce
22fc808
b86364e
25d2650
d1987bf
3f77b98
95587be
5ddd442
9a21052
051ebf7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,8 @@ pub enum Error { | |
| LeadingZero, | ||
| /// Overran input while decoding. | ||
| InputTooShort, | ||
| /// Additional trailing bytes found after decoding. | ||
| TrailingBytes, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this can be expressed with the Unexptectedlength variant
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering that this is currently returned when the payload length doesn't match the array size or other payload length issues, I didn't think it would be a good fit for this since
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would be ok with the new variant however this is unfortunately a breaking change because the enum is not marked as |
||
| /// Expected single byte, but got invalid value. | ||
| NonCanonicalSingleByte, | ||
| /// Expected size, but got invalid value. | ||
|
|
@@ -42,6 +44,7 @@ impl fmt::Display for Error { | |
| Self::Overflow => f.write_str("overflow"), | ||
| Self::LeadingZero => f.write_str("leading zero"), | ||
| Self::InputTooShort => f.write_str("input too short"), | ||
| Self::TrailingBytes => f.write_str("trailing bytes"), | ||
| Self::NonCanonicalSingleByte => f.write_str("non-canonical single byte"), | ||
| Self::NonCanonicalSize => f.write_str("non-canonical size"), | ||
| Self::UnexpectedLength => f.write_str("unexpected length"), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.