Skip to content

Support reject_trailing_bytes config option #199

@kskalski

Description

@kskalski

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions