Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReject trailing bytes when deserializing from &[u8] #193
Comments
|
#192 (comment) gives a workaround to detect trailing bytes. |
|
I'm wondering if this is possible to achieve without incurring a performance penalty. The first method that came to mind was to modify the Edit: I've figured out a way to do this but the code ends up being much nicer if we can use |
|
Thanks for tackling this.
|
|
I'm moving this to post-1.0 because I don't think that it is fundamental to the library and can be added in a backwards compatible way with a config option. The config option won't even need to be a compile-time reified config option either. |
In
deserialize_from, it makes sense to allow deserializing multiple values from the same io::Read. But indeserialize, I think trailing data should be an error.I would expect this to be an error rather than ignoring
b"x":