Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Serialize and deserialize bytes without length #255

@cauebs

Description

@cauebs

I and a friend are implementing a binary network protocol and wanted to serialize and deserialize structs to and from raw bytes, without padding. Some of these structs contain a payload field at the end, which can be arbitrarily large, but is always the last to be read or written. The problem we now faced is that bincode always writes the length (in serialize_bytes) and expects it to be present when deserializing as well. I can't think of a good way to offer this option, considering the limitations of the traits provided by serde, but I really think this should be possible. Any thoughts?

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