-
Notifications
You must be signed in to change notification settings - Fork 62
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
Consider implment borshSerialize/de for (serde::)Serialize/de #8
Comments
Great proposal! I think it should be possible to implement it under a feature-flag, and also prefer native Borsh implementations before falling back to serde serializations. |
This would be a great feature. I was looking to replace Bincode with Borsh, but without being able to use |
Hm, I think this is not the right thing to do. My understanding is that one (primary) design goal of borsh is canonicity/consistency:
Serde is not canonical -- it can deserialize the same object from different representations (eg, order of key/values in a hashmap). We can't layer a canonical repr on top of a non-canonical one. If the particular use-case does not require canonicity, then bincode should be used instead of borsh. |
I did not know that feature of serde. I am closing this issue since there are not action items |
This gives a few benefits:
impl borshSerialize for IndexMap
, they cannot do because both the trait and the type is not in their crate. They have to wrap it tostruct MyIndexMap(IndexMap)
andimpl borshSerialize for MyIndexMap
Cons is with extra layer of Serde::Serialize trait, this may slowdown borsh, to be research
The text was updated successfully, but these errors were encountered: