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

Rename AsBytes to IntoBytes #695

Closed
2 tasks done
Tracked by #251
joshlf opened this issue Dec 8, 2023 · 0 comments · Fixed by #700
Closed
2 tasks done
Tracked by #251

Rename AsBytes to IntoBytes #695

joshlf opened this issue Dec 8, 2023 · 0 comments · Fixed by #700
Labels
compatibility-breaking Changes that are (likely to be) breaking

Comments

@joshlf
Copy link
Member

joshlf commented Dec 8, 2023

Progress

  • Decide between ToBytes and IntoBytes
    • Decided to go with IntoBytes so that FromBytes/IntoBytes is symmetrical with stdlib's From/Into
  • Implementation
    • In progress in #700

Description

Now that AsBytes permits UnsafeCells as part of #251, it can be implemented for types which support value-only transmutation (ie, for which fn as_bytes(&self) -> &[u8] where Self: NoCell is not available because Self: !NoCell). Given this change, a more appropriate name for the trait would be IntoBytes. This also brings our pair of FromBytes/IntoBytes into line with the existing pattern of From/Into.

@joshlf joshlf added the compatibility-breaking Changes that are (likely to be) breaking label Dec 8, 2023
joshlf added a commit that referenced this issue Dec 8, 2023
joshlf added a commit that referenced this issue Dec 8, 2023
joshlf added a commit that referenced this issue Dec 8, 2023
joshlf added a commit that referenced this issue Dec 8, 2023
Previously, `T: AsBytes` indicated that `&T -> &[u8]` was a valid
transformation. As of #682, `T: AsBytes` only indicates that `T -> [u8]`
is a valid transformation. This slightly changes the meaning of
`AsBytes` and makes `ToBytes` a more appropriate name since it only
permits value rather than reference transmutations. This also brings the
pair of `FromBytes` and `ToBytes` in line with the standard library
`From` and `Into` traits from a naming perspective.

Closes #695
joshlf added a commit that referenced this issue Dec 11, 2023
Previously, `T: AsBytes` indicated that `&T -> &[u8]` was a valid
transformation. As of #682, `T: AsBytes` only indicates that `T -> [u8]`
is a valid transformation. This slightly changes the meaning of
`AsBytes` and makes `IntoBytes` a more appropriate name since it only
permits value rather than reference transmutations. This also brings the
pair of `FromBytes` and `IntoBytes` in line with the standard library
`From` and `Into` traits from a naming perspective.

Closes #695
@joshlf joshlf changed the title Rename AsBytes to ToBytes Rename AsBytes to IntoBytes Dec 11, 2023
joshlf added a commit that referenced this issue Dec 11, 2023
Previously, `T: AsBytes` indicated that `&T -> &[u8]` was a valid
transformation. As of #682, `T: AsBytes` only indicates that `T -> [u8]`
is a valid transformation. This slightly changes the meaning of
`AsBytes` and makes `IntoBytes` a more appropriate name since it only
permits value rather than reference transmutations. This also brings the
pair of `FromBytes` and `IntoBytes` in line with the standard library
`From` and `Into` traits from a naming perspective.

Closes #695
joshlf added a commit that referenced this issue Dec 11, 2023
Previously, `T: AsBytes` indicated that `&T -> &[u8]` was a valid
transformation. As of #682, `T: AsBytes` only indicates that `T -> [u8]`
is a valid transformation. This slightly changes the meaning of
`AsBytes` and makes `IntoBytes` a more appropriate name since it only
permits value rather than reference transmutations. This also brings the
pair of `FromBytes` and `IntoBytes` in line with the standard library
`From` and `Into` traits from a naming perspective.

Closes #695
joshlf added a commit that referenced this issue Dec 11, 2023
Previously, `T: AsBytes` indicated that `&T -> &[u8]` was a valid
transformation. As of #682, `T: AsBytes` only indicates that `T -> [u8]`
is a valid transformation. This slightly changes the meaning of
`AsBytes` and makes `IntoBytes` a more appropriate name since it only
permits value rather than reference transmutations. This also brings the
pair of `FromBytes` and `IntoBytes` in line with the standard library
`From` and `Into` traits from a naming perspective.

Closes #695
github-merge-queue bot pushed a commit that referenced this issue Dec 14, 2023
Previously, `T: AsBytes` indicated that `&T -> &[u8]` was a valid
transformation. As of #682, `T: AsBytes` only indicates that `T -> [u8]`
is a valid transformation. This slightly changes the meaning of
`AsBytes` and makes `IntoBytes` a more appropriate name since it only
permits value rather than reference transmutations. This also brings the
pair of `FromBytes` and `IntoBytes` in line with the standard library
`From` and `Into` traits from a naming perspective.

Closes #695
joshlf added a commit that referenced this issue Feb 23, 2024
This makes the transition from `AsBytes` to `IntoBytes` (its new name)
easier.

Makes progress on #695
joshlf added a commit that referenced this issue Feb 23, 2024
This makes the transition from `AsBytes` to `IntoBytes` (its new name)
easier.

Makes progress on #695
joshlf added a commit that referenced this issue Feb 23, 2024
This makes the transition from `AsBytes` to `IntoBytes` (its new name)
easier.

Makes progress on #695
github-merge-queue bot pushed a commit that referenced this issue Feb 23, 2024
This makes the transition from `AsBytes` to `IntoBytes` (its new name)
easier.

Makes progress on #695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-breaking Changes that are (likely to be) breaking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant