Add a skip
method to the Read
trait
#53294
Labels
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
The
Read
trait doesn't currently offer an optimal way to discard a number of bytes from the data source. Using thebytes()
iterator requires you to evaluate aResult
for each byte you discard and usingread_exact()
requires you to provide a buffer to unnecessarily fill.This solution (borrowed from a StackOverflow answer) seems to work nicely:
I can put a PR together if you'd like.
The text was updated successfully, but these errors were encountered: