You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For exchanges and other consumers of the solana-account-decoder crate types who use them outside of the footprint of this repo, it is super inconvenient that most of these types do not implement Clone (and/or Copy when appropriate). Right now in our footprint we work around this by painstakingly implementing Clone on wrapper types for the majority of types in the crate. These wrapper types are tricky to maintain and are highly sensitive to breaking changes in the form of new/changed struct fields.
Proposed Solution
I will happily go through and derive Clone and/or Copy where appropriate throughout this crate, I just don't want to take the time to do that unless there is consensus that this should be done.
If Copy is contentious, how about just Clone?
The text was updated successfully, but these errors were encountered:
In our case this was in a serde serialize/deserialize flow using bincode's codec features, the TLDR being you end up in a situation where you have to take ownership to produce the serialization because of how codec works, but because there is effectively no way to duplicate these solana types (other than a very inefficient extra serialize => deserialize flow just to get the original back), the only remaining option becomes "implement a custom Klone trait on all the types" which is what we actually did in the end 😆
the lesson though is it's pretty reasonable to expect people will always want some way of cloning your public types for various reasons and Rust's orphan rule effectively makes this your responsibility as a library maintainer, for better or for worse
Problem
For exchanges and other consumers of the
solana-account-decoder
crate types who use them outside of the footprint of this repo, it is super inconvenient that most of these types do not implementClone
(and/orCopy
when appropriate). Right now in our footprint we work around this by painstakingly implementingClone
on wrapper types for the majority of types in the crate. These wrapper types are tricky to maintain and are highly sensitive to breaking changes in the form of new/changed struct fields.Proposed Solution
I will happily go through and derive
Clone
and/orCopy
where appropriate throughout this crate, I just don't want to take the time to do that unless there is consensus that this should be done.If
Copy
is contentious, how about justClone
?The text was updated successfully, but these errors were encountered: