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

<[T, $n]>::decode implementation can make use of TypeInfo #207

Open
gui1117 opened this issue Apr 9, 2020 · 0 comments
Open

<[T, $n]>::decode implementation can make use of TypeInfo #207

gui1117 opened this issue Apr 9, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@gui1117
Copy link
Contributor

gui1117 commented Apr 9, 2020

for now it decode using an ArrayVec but this can be optimised for type with TypeInfo

fn decode<I: Input>(input: &mut I) -> Result<Self, Error> {
let mut r = ArrayVec::new();
for _ in 0..$n {
r.push(T::decode(input)?);
}
let i = r.into_inner();
match i {
Ok(a) => Ok(a),
Err(_) => Err("failed to get inner array from ArrayVec".into()),
}
}

@gui1117 gui1117 added the enhancement New feature or request label Apr 9, 2020
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
None yet
Development

No branches or pull requests

1 participant