Currently when deserializing we just consume data from reader, any unconsumed data in reader is silently ignored / accepted when its prefix succeeds in deserialization. Sometimes it's desired to verify that input is exactly the data that matches serialization format without any extras, which could indicate errors.
This can be checked by keeping around the reader (using by_ref() or &mut to keep ownership) and verifying it no longer has data, but it's not very convenient.
Analogous to bincode's reject_trailing_bytes, we should have an option to do that.
I imagine Configuration should have it as constant, not sure exactly when we should check it - the option should be checked after deserialization, but it needs to be erased for any deserialization until the final one. Maybe it should be done on top level deserialize and config passed to inner call should have the option erased.
Currently when deserializing we just consume data from reader, any unconsumed data in reader is silently ignored / accepted when its prefix succeeds in deserialization. Sometimes it's desired to verify that input is exactly the data that matches serialization format without any extras, which could indicate errors.
This can be checked by keeping around the reader (using
by_ref()or&mutto keep ownership) and verifying it no longer has data, but it's not very convenient.Analogous to bincode's
reject_trailing_bytes, we should have an option to do that.I imagine
Configurationshould have it as constant, not sure exactly when we should check it - the option should be checked after deserialization, but it needs to be erased for any deserialization until the final one. Maybe it should be done on top leveldeserializeand config passed to inner call should have the option erased.