Skip to content
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

Add Decoder.Skip() to skip CBOR data item in CBOR Sequences (RFC 8742) #381

Merged
merged 1 commit into from
Jan 1, 2023

Conversation

fxamacker
Copy link
Owner

@fxamacker fxamacker commented Jan 1, 2023

When decoding CBOR Sequences (RFC 8742), it can be useful to skip to the next CBOR data item without decoding.

This PR adds Decoder.Skip() which will skip to next CBOR data item (if there is any) otherwise it will return error such as io.EOF, io.UnexpectedEOF, etc.

Special thanks to @espoal and @x448 for their comments on this feature.

Closes #366

When decoding CBOR Sequences (RFC 8742), it can be
useful to skip to the next CBOR data item without decoding.

This change adds Decoder.Skip() which will skip
to next CBOR data item (if there is any) otherwise
it will return error such as io.EOF, io.UnexpectedEOF, etc.
@fxamacker fxamacker added this to the v2.5.0 milestone Jan 1, 2023
}
}

func TestDecoderSkip(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice work keeping coverage above 98%.

@fxamacker fxamacker merged commit f57ecbe into master Jan 1, 2023
@fxamacker fxamacker deleted the fxamacker/add-decoder-skip branch January 2, 2023 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: Add Skip() to Decoder
2 participants