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

Add slice-based methods to FromBytes #593

Merged
merged 1 commit into from
Nov 3, 2023
Merged

Conversation

newpavlov
Copy link
Contributor

Right now slice conversion methods are somewhat buried in Ref. For better ergonomics and discoverability I think it's worth to have the slice-based methods on the FromBytes trait.

Copy link

google-cla bot commented Nov 3, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Member

@joshlf joshlf left a comment

Choose a reason for hiding this comment

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

Thanks for this!

src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
@newpavlov newpavlov force-pushed the slice_methods branch 2 times, most recently from b0c139a to 29e15d7 Compare November 3, 2023 13:18
@newpavlov
Copy link
Contributor Author

Done! I've used [`FromBytes::slice_from_prefix`] instead of [`slice_from_prefix`], but I can replace it to [`slice_from_prefix`](FromBytes::slice_from_prefix) if you prefer it.

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@joshlf
Copy link
Member

joshlf commented Nov 3, 2023

Done! I've used [`FromBytes::slice_from_prefix`] instead of [`slice_from_prefix`], but I can replace it to [`slice_from_prefix`](FromBytes::slice_from_prefix) if you prefer it.

Oops, just saw this. Yeah, that'd be preferable, thanks!

@joshlf
Copy link
Member

joshlf commented Nov 3, 2023

Okay, looks good! Could you update Cargo.toml and zerocopy-derive/Cargo.toml to bump the version number to 0.7.24 so I can release this once it merges to main? There are four locations you'll need to update in Cargo.toml and one in zerocopy-derive/Cargo.toml.

@newpavlov
Copy link
Contributor Author

Done!

Copy link
Member

@joshlf joshlf left a comment

Choose a reason for hiding this comment

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

Sweet, thanks!

@joshlf joshlf enabled auto-merge November 3, 2023 13:35
@joshlf joshlf added this pull request to the merge queue Nov 3, 2023
Merged via the queue into google:main with commit b771d91 Nov 3, 2023
126 checks passed
@newpavlov newpavlov deleted the slice_methods branch November 3, 2023 13:51
@joshlf
Copy link
Member

joshlf commented Nov 3, 2023

Published!

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.

None yet

2 participants