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 decode_from_bytes #342

Merged
merged 2 commits into from
May 31, 2022

Conversation

koute
Copy link
Contributor

@koute koute commented May 25, 2022

This PR adds a new public API:

fn decode_from_bytes<T>(bytes: bytes::Bytes) -> Result<T, Error> where T: Decode

This allows zero-copy deserialization of raw bytes when the input is also Bytes.

See the comment in decode_from_bytes for an explanation as to why this method was added instead of simply implementing Input for Bytes.

@gavofyork gavofyork merged commit 361a0bf into paritytech:master May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: done
Development

Successfully merging this pull request may close these issues.

2 participants