-
Notifications
You must be signed in to change notification settings - Fork 150
address: Add copy feature #343
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
Conversation
|
Looks great! We just need to have a firm idea of how to release it. I think it's the perfect time for the semver trick |
| } | ||
|
|
||
| pub const fn to_bytes(self) -> [u8; 32] { | ||
| pub const fn to_bytes(&self) -> [u8; 32] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking a reference avoids breaking code that relied on address being Copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one still looks good to me! The changes are consistent with the Copy changes from Hash since we don't add it as a default feature, and to_bytes has been modified to take a reference.
Edit: it just needs a rebase
joncinque
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
rustopian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Problem
As described in #342 , deriving
Copyby default makes it easier to create more copies than expected, in particular when writing on-chain programs.Solution
Add a feature
"copy"so the derive is opt-in.Closes #342