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

Implement ByteSlice and ByteSliceMut for Vec<u8> #992

Open
joshlf opened this issue Mar 1, 2024 · 0 comments
Open

Implement ByteSlice and ByteSliceMut for Vec<u8> #992

joshlf opened this issue Mar 1, 2024 · 0 comments

Comments

@joshlf
Copy link
Member

joshlf commented Mar 1, 2024

Builds on #1.

joshlf added a commit that referenced this issue May 8, 2024
This allows us to more strictly enforce the requirement that, for
`Ref`'s `ByteSlice` field, methods are never called other than those
defined on the `ByteSlice`, `ByteSliceMut`, `IntoByteSlice`, and
`IntoByteSliceMut` traits. We accomplish this by keeping the field
private, and only exposing unsafe getters which return, for example,
`&impl ByteSlice`.

We also introduce new traits - `CopyableByteSlice` and
`CloneableByteSlice`. We tighten the `Copy` and `Clone` impls for `Ref`
to require these bounds. Previously, `ByteSlice` required that its
"dereference stability" requirement applied to any `Copy` or `Clone`
impls, but this would have prevented us from implementing `ByteSlice`
for `Vec`. By splitting the requirement into separate traits, we open
the door to supporting `Vec` (#992).
joshlf added a commit that referenced this issue May 8, 2024
This allows us to more strictly enforce the requirement that, for
`Ref`'s `ByteSlice` field, methods are never called other than those
defined on the `ByteSlice`, `ByteSliceMut`, `IntoByteSlice`, and
`IntoByteSliceMut` traits. We accomplish this by keeping the field
private, and only exposing unsafe getters which return, for example,
`&impl ByteSlice`.

We also introduce new traits - `CopyableByteSlice` and
`CloneableByteSlice`. We tighten the `Copy` and `Clone` impls for `Ref`
to require these bounds. Previously, `ByteSlice` required that its
"dereference stability" requirement applied to any `Copy` or `Clone`
impls, but this would have prevented us from implementing `ByteSlice`
for `Vec`. By splitting the requirement into separate traits, we open
the door to supporting `Vec` (#992).
joshlf added a commit that referenced this issue May 8, 2024
This allows us to more strictly enforce the requirement that, for
`Ref`'s `ByteSlice` field, methods are never called other than those
defined on the `ByteSlice`, `ByteSliceMut`, `IntoByteSlice`, and
`IntoByteSliceMut` traits. We accomplish this by keeping the field
private, and only exposing unsafe getters which return, for example,
`&impl ByteSlice`.

We also introduce new traits - `CopyableByteSlice` and
`CloneableByteSlice`. We tighten the `Copy` and `Clone` impls for `Ref`
to require these bounds. Previously, `ByteSlice` required that its
"dereference stability" requirement applied to any `Copy` or `Clone`
impls, but this would have prevented us from implementing `ByteSlice`
for `Vec`. By splitting the requirement into separate traits, we open
the door to supporting `Vec` (#992).
joshlf added a commit that referenced this issue May 8, 2024
This allows us to more strictly enforce the requirement that, for
`Ref`'s `ByteSlice` field, methods are never called other than those
defined on the `ByteSlice`, `ByteSliceMut`, `IntoByteSlice`, and
`IntoByteSliceMut` traits. We accomplish this by keeping the field
private, and only exposing unsafe getters which return, for example,
`&impl ByteSlice`.

We also introduce new traits - `CopyableByteSlice` and
`CloneableByteSlice`. We tighten the `Copy` and `Clone` impls for `Ref`
to require these bounds. Previously, `ByteSlice` required that its
"dereference stability" requirement applied to any `Copy` or `Clone`
impls, but this would have prevented us from implementing `ByteSlice`
for `Vec`. By splitting the requirement into separate traits, we open
the door to supporting `Vec` (#992).
joshlf added a commit that referenced this issue May 8, 2024
This allows us to more strictly enforce the requirement that, for
`Ref`'s `ByteSlice` field, methods are never called other than those
defined on the `ByteSlice`, `ByteSliceMut`, `IntoByteSlice`, and
`IntoByteSliceMut` traits. We accomplish this by keeping the field
private, and only exposing unsafe getters which return, for example,
`&impl ByteSlice`.

We also introduce new traits - `CopyableByteSlice` and
`CloneableByteSlice`. We tighten the `Copy` and `Clone` impls for `Ref`
to require these bounds. Previously, `ByteSlice` required that its
"dereference stability" requirement applied to any `Copy` or `Clone`
impls, but this would have prevented us from implementing `ByteSlice`
for `Vec`. By splitting the requirement into separate traits, we open
the door to supporting `Vec` (#992).
joshlf added a commit that referenced this issue May 9, 2024
This allows us to more strictly enforce the requirement that, for
`Ref`'s `ByteSlice` field, methods are never called other than those
defined on the `ByteSlice`, `ByteSliceMut`, `IntoByteSlice`, and
`IntoByteSliceMut` traits. We accomplish this by keeping the field
private, and only exposing unsafe getters which return, for example,
`&impl ByteSlice`.

We also introduce new traits - `CopyableByteSlice` and
`CloneableByteSlice`. We tighten the `Copy` and `Clone` impls for `Ref`
to require these bounds. Previously, `ByteSlice` required that its
"dereference stability" requirement applied to any `Copy` or `Clone`
impls, but this would have prevented us from implementing `ByteSlice`
for `Vec`. By splitting the requirement into separate traits, we open
the door to supporting `Vec` (#992).
joshlf added a commit that referenced this issue May 9, 2024
This allows us to more strictly enforce the requirement that, for
`Ref`'s `ByteSlice` field, methods are never called other than those
defined on the `ByteSlice`, `ByteSliceMut`, `IntoByteSlice`, and
`IntoByteSliceMut` traits. We accomplish this by keeping the field
private, and only exposing unsafe getters which return, for example,
`&impl ByteSlice`.

We also introduce new traits - `CopyableByteSlice` and
`CloneableByteSlice`. We tighten the `Copy` and `Clone` impls for `Ref`
to require these bounds. Previously, `ByteSlice` required that its
"dereference stability" requirement applied to any `Copy` or `Clone`
impls, but this would have prevented us from implementing `ByteSlice`
for `Vec`. By splitting the requirement into separate traits, we open
the door to supporting `Vec` (#992).
github-merge-queue bot pushed a commit that referenced this issue May 9, 2024
This allows us to more strictly enforce the requirement that, for
`Ref`'s `ByteSlice` field, methods are never called other than those
defined on the `ByteSlice`, `ByteSliceMut`, `IntoByteSlice`, and
`IntoByteSliceMut` traits. We accomplish this by keeping the field
private, and only exposing unsafe getters which return, for example,
`&impl ByteSlice`.

We also introduce new traits - `CopyableByteSlice` and
`CloneableByteSlice`. We tighten the `Copy` and `Clone` impls for `Ref`
to require these bounds. Previously, `ByteSlice` required that its
"dereference stability" requirement applied to any `Copy` or `Clone`
impls, but this would have prevented us from implementing `ByteSlice`
for `Vec`. By splitting the requirement into separate traits, we open
the door to supporting `Vec` (#992).
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

No branches or pull requests

1 participant