-
Notifications
You must be signed in to change notification settings - Fork 95
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 skip()
#201
Comments
we do agree that skipping an encoded object shouldn't check that the object is valid. So if someone works on untrusted data, skipping some part of the data to get the wanted part can succeed even if the data will actually fail to decode. |
We don't really check if an object is valid? But yeah, normally we just skip the amount of expected bytes. |
Maybe we should also introduce a new function: /// Can return the length of the type if fixed.
fn length() -> Option<usize> { None } this would be used to optimized implementation of if let Some(size) = T::length {
// decode compact and skip size*compact
} At least we could put this new method in decode with default to None and improve on it later. |
skip is now part of Decode trait. I think we can close this issue in favor of #244 |
The
Decode
trait should get a methodskip(input: &mut Input)
to skip an encoded object.The text was updated successfully, but these errors were encountered: