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

Use Bytes to avoid double indirection with Arc<Vec<u8>> #118

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

nazar-pc
Copy link
Contributor

@nazar-pc nazar-pc commented Oct 12, 2024

Due to inner mutation Bytes had to be used instead of Arc<[u8]>, which achieves the same result as before, but without double indirection that was used before. Public API is unchanged.

BytesMut::from(Bytes) attempts to reuse allocation just like Arc::make_mut() did before.

Fixes #117

Copy link
Contributor

@jxs jxs left a comment

Choose a reason for hiding this comment

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

LGTM, thanks Nazar

@jxs jxs merged commit fe847fa into multiformats:master Oct 14, 2024
4 checks passed
@nazar-pc nazar-pc deleted the use-bytes branch October 14, 2024 19:46
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.

Replace Arc<Vec<u8>> with Arc<[u8]>
2 participants