Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bytes::Bytes for ZBytes #1248

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

evshary
Copy link
Contributor

@evshary evshary commented Jul 19, 2024

Since uProtocol UPayload is using bytes::Bytes, I think it will be good if we can support the transformation in ZBytes.

@evshary
Copy link
Contributor Author

evshary commented Jul 19, 2024

@Mallets Could you please help me review it?

Copy link
Contributor Author

@evshary evshary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
I don't see any other way to avoid copy in deserialization...

// ZSlice resulting in zero-copy and zero-alloc bytes::Bytes serialization.
#[repr(transparent)]
#[derive(Debug)]
struct BytesWrap(bytes::Bytes);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we use BytesWrap to wrap Bytes is to avoid the orphan rule, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

@Mallets Mallets merged commit cf4d3d3 into eclipse-zenoh:dev/1.0.0 Jul 23, 2024
12 checks passed
@evshary evshary deleted the support_bytes_for_ZBytes branch July 24, 2024 03:24
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.

2 participants