-
Notifications
You must be signed in to change notification settings - Fork 105
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
impl Clone + Copy for Ref #627
Comments
This should be doable; I'll put it on our roadmap for 0.8. |
joshlf
added a commit
that referenced
this issue
Mar 1, 2024
joshlf
added a commit
that referenced
this issue
Mar 1, 2024
joshlf
added a commit
that referenced
this issue
Mar 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since
Ref
is essentially a reference type, it would be nice if it implementedClone
andCopy
when the underlyingByteSlice
does. The whole point ofzerocopy
is not copying, so I imagineclone
ing the entire underlying type through theDeref
impl (which this would interfere with) is not a common operation.My use case: I followed the example for parsing a UDP header, so my structs look like this:
I can't take
&self
, do some processing on aRef
, and hand out types with the same lifetime as the underlying slice. But I can't takeself
either, because I do this for more than one field andRef: !Clone
, so my struct is!Clone
too. I'd like to do something like this:Am I missing a soundness issue?
The text was updated successfully, but these errors were encountered: