Skip to content
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

Add implementation of Borsh::(De)Serialize traits #153

Open
totikom opened this issue Sep 30, 2021 · 3 comments
Open

Add implementation of Borsh::(De)Serialize traits #153

totikom opened this issue Sep 30, 2021 · 3 comments
Labels
Enhancement New feature or request Help Wanted I need outside help for this to happen.

Comments

@totikom
Copy link

totikom commented Sep 30, 2021

The same way, as you have serde traits under serde feature, you can add borsh traits under borsh feature.

@Lokathor
Copy link
Owner

I would accept such a PR but am unfamiliar with the crate and am unlikely to do this myself.

@Lokathor Lokathor added Enhancement New feature or request Help Wanted I need outside help for this to happen. labels Sep 30, 2021
@totikom
Copy link
Author

totikom commented Sep 30, 2021

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.

@Shnatsel
Copy link
Collaborator

Shnatsel commented Sep 30, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Help Wanted I need outside help for this to happen.
Projects
None yet
Development

No branches or pull requests

3 participants