Skip to content

Support borrowed-slice deserialization from cdr-encoding#408

Open
oxkitsune wants to merge 3 commits intoAtostek:masterfrom
rerun-io:gijs/zero-copy-cdr
Open

Support borrowed-slice deserialization from cdr-encoding#408
oxkitsune wants to merge 3 commits intoAtostek:masterfrom
rerun-io:gijs/zero-copy-cdr

Conversation

@oxkitsune
Copy link
Copy Markdown
Contributor

What

Pulls in the upstream zero-copy changes from Atostek/cdr-encoding#6. serde::Deserialize<'de> types can now borrow from the input buffer directly. Byte payloads in particular go through a proper bytes path instead of one byte at a time through seq.

Why

The upstream PR targets ROS2 sensor messages (images, point clouds), where copying every byte payload is wasteful. With these adapter changes, we have the plumbing to expose zero-copy reads to RustDDS users in a follow-up. Borrowing types already deserialize through from_bytes_with, and the read-path API can be extended to hand them out without copying.

Compatibility

Public API change:

  • Third-party Decode implementors need to add the 'de lifetime parameter.
  • Default-decoder users (the common case via CDRDeserializerAdapter) are unaffected. The for<'de> HRTB keeps the existing DeserializeOwned requirement on that path.

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