Skip to content

Zero copy byte deserialization#6

Open
iblnkn wants to merge 2 commits intoAtostek:masterfrom
iblnkn:zero-copy-byte-deserialization
Open

Zero copy byte deserialization#6
iblnkn wants to merge 2 commits intoAtostek:masterfrom
iblnkn:zero-copy-byte-deserialization

Conversation

@iblnkn
Copy link
Copy Markdown

@iblnkn iblnkn commented Mar 25, 2026

We're using this crate to deserialize ROS2 sensor messages (images, point clouds) and needed efficient handling of large byte payloads.

Changes:

  1. Implements the bytes path correctly so byte payloads can be
    serialized and deserialized as contiguous blocks instead of
    one byte at a time through the seq path.

  2. Fixes the deserializer's lifetime constraints so borrowed slices
    can reference the input buffer directly, enabling zero-copy
    deserialization.

Added tests

  • Round-trip tests for owned bytes, empty bytes, borrowed bytes, and
    bytes embedded in a struct
  • Cross-path test: data serialized as Vec<u8> can be deserialized
    through the bytes path
  • Regression test confirming Vec<u8> without serde_bytes still works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant