Add deserialize_exact APIs to reject trailing bytes#254
Open
tanmay4l wants to merge 2 commits intoanza-xyz:masterfrom
Open
Add deserialize_exact APIs to reject trailing bytes#254tanmay4l wants to merge 2 commits intoanza-xyz:masterfrom
tanmay4l wants to merge 2 commits intoanza-xyz:masterfrom
Conversation
kskalski
reviewed
Mar 26, 2026
Contributor
kskalski
left a comment
There was a problem hiding this comment.
I think this is the correct API we want to have.
Additional thoughts on those modules - I'm looking into cleaning up the serde functions, so far the idea is to:
- remove traits and rely only on free functions (this addition meets the criteria of target API to stay) or let user use
Schema*directly (any more complex use-case not permitted by free function) - switch input slices to
impl Reader- currentdeserialize_exactgoes against this direction - alternative would be to enrichReaderwithhas_dataAPI, which might be a way to go, it could be inefficient for non-slice readers, but given that checking for trailing bytes will only be done on demand with the top level functions, maybe it's fine @cpubot ? - remove
deserialize_from(superceded bydeserializetakingReader)
cpubot
reviewed
Mar 26, 2026
Contributor
There was a problem hiding this comment.
I think this API shape is fine as is. We need not consider further API reorganization to ship this functionality. Once we have an agreed upon direction as far as an API re-design / reorganization, we can figure out how to handle in that context.
Another note: we should add clear documentation to these functions as well with doctests.
cpubot
reviewed
Mar 26, 2026
cpubot
reviewed
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #199