-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add fn skip(n: uint) with a default implementation to Reader #13989
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
This seems useful though reader does have a few methods on it already. I'm wondering what @alexcrichton thinks? |
I'm worried about adding more methods to readers that downstream consumers need to consider to override. Having one I don't think that we can quite use |
Any news on this? I'm writing an IFF reader and I want users to be able to skip chunk bodies, requiring Seek for just this seems overkill. |
The problem is that given today's (and likely future) coherence rules, you cannot create a trait that uses impl<T: Seek> PossiblyInefficientSeek for T {
// ...
}
impl<T: Reader> PossiblyInefficientSeek for T {
// ...
} This is actually a decent motivating use-case for allowing an implementation of a trait to refine an existing implementation defined on a superset of types. |
@pongad I do not think |
@alexcrichton it is true that having too many random convenience methods can be a problem, but I think that it makes sense to add methods for operations that can be implemented much more efficiently in some contexts than others. In other words, while |
One step forward to rust-lang#13989 Signed-off-by: NODA, Kai <nodakai@gmail.com>
Resolve rust-lang#13989 Signed-off-by: NODA, Kai <nodakai@gmail.com>
@carllerche did this end up getting addressed in io reform? |
@steveklabnik Not yet. I think (hope) it is coming pre 1.0 though. cc @aturon |
Nominating for 1.0-beta P-high. (Should be trivial.) |
P-high, I-needs-decision (not 1.0 beta blocker) |
In today's day and age this sort of addition (to a core trait like |
internal: Remove hover fallback in favor of ranged hover The fallback is usually more annoying than useful at this point (it messes with the range of diagnostic popups a lot), we now have a ranged hover to check the type of something which works a lot better. Closes rust-lang/rust-analyzer#11602
…rust-lang#14014) This PR changes literal_string_with_formatting_args category from `suspicious` to `nursery` since there are thousands of false positive on GitHub. Closes rust-lang#13989 since it's no longer problematic with such false positive with ~~`pedantic`~~ `nursery` category. changelog: [`literal_string_with_formatting_args` ] change category to `nursery` from `suspicious`
…rust-lang#14014) This PR changes literal_string_with_formatting_args category from `suspicious` to `nursery` since there are thousands of false positive on GitHub. Closes rust-lang#13989 since it's no longer problematic with such false positive with ~~`pedantic`~~ `nursery` category. changelog: [`literal_string_with_formatting_args` ] change category to `nursery` from `suspicious`
…rust-lang#14014) This PR changes literal_string_with_formatting_args category from `suspicious` to `nursery` since there are thousands of false positive on GitHub. Closes rust-lang#13989 since it's no longer problematic with such false positive with ~~`pedantic`~~ `nursery` category. changelog: [`literal_string_with_formatting_args` ] change category to `nursery` from `suspicious`
Reader should have an extra fn that allows skipping a number of bytes. The default implementation could look something like:
However, BufReader could implement the fn by simply updating the internal cursor. This would allow more efficient skipping w/o having to require Seek.
The text was updated successfully, but these errors were encountered: