tinyvec
tinyvec copied to clipboard
Add implementation of Borsh::(De)Serialize traits
The same way, as you have serde traits under serde
feature, you can add borsh traits under borsh
feature.
I would accept such a PR but am unfamiliar with the crate and am unlikely to do this myself.
Looks like Borsh is implemented for both [T; N]
and &[T]
, so it is possible, that #[derive(BorshSerialize)]
will be sufficient. I'll try it and, if it will be successful, send a PR.
The implementation of BorshSerialize
specifically should probably just coerce TinyVec to a slice and serialize that. Deserialization, on the other hand, is trickier.
Note that it's also possible to implement this in borsh
crate rather than tinyvec
, and it may make more sense to do so.