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 array conversions #6

Merged
merged 2 commits into from
Jun 19, 2024
Merged

Add array conversions #6

merged 2 commits into from
Jun 19, 2024

Conversation

robin-nitrokey
Copy link
Member

@robin-nitrokey robin-nitrokey commented Jun 19, 2024

This patch adds infallible conversions from arrays of the same size and references to arrays of the same or a smaller size.

@robin-nitrokey robin-nitrokey requested a review from a team June 19, 2024 12:59
@sosthene-nitrokey
Copy link
Contributor

I'm in the process implementing what was discussed in #4

@robin-nitrokey
Copy link
Member Author

Ah, I missed the point with the from method. I’ll just drop the commit from this PR.

@robin-nitrokey robin-nitrokey changed the title Remove redundant Bytes::from and add array conversions Add array conversions Jun 19, 2024
Copy link
Contributor

@sosthene-nitrokey sosthene-nitrokey left a comment

Choose a reason for hiding this comment

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

I would also add a method for converting a Bytes<N> to Bytes<M> where M >= N. This can't be done through the usual conversion traits, but it can still be useful.

@robin-nitrokey
Copy link
Member Author

  • Removed Bytes::from again because otherwise it is much harder to write the examples for the From implementations.
  • Added a message to the assert!.
  • Added Bytes::increase_capacity.

@robin-nitrokey robin-nitrokey merged commit 7840edb into main Jun 19, 2024
1 check passed
@robin-nitrokey robin-nitrokey deleted the conversions branch June 19, 2024 14:34
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