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

Implement Stream::size_hint method on stream utilities #953

Open
taiki-e opened this issue Feb 5, 2021 · 4 comments
Open

Implement Stream::size_hint method on stream utilities #953

taiki-e opened this issue Feb 5, 2021 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@taiki-e
Copy link
Contributor

taiki-e commented Feb 5, 2021

Most of async-std's stream utilities were written before Stream::size_hint was released and do not implement Stream::size_hint method. This means that async-std's stream utilities may be a bit inefficient than other crates such as futures, tokio-stream, futures-lite, which provide similar utilities.

related: rust-lang/futures-rs#1853, rust-lang/rust#81797

@dignifiedquire dignifiedquire added enhancement New feature or request good first issue Good for newcomers labels Feb 17, 2021
@mich2000
Copy link

Hey guys I wanted to know if on the size_hint method in the stream trait on the crate, if I should give it a default implementation. Something like below, a default size_hint is implemented in the stream module in the standard library.

fn size_hint(&self) -> (usize, Option) {
(0, None)
};

@taiki-e
Copy link
Contributor Author

taiki-e commented Mar 22, 2021

IIRC, this crate's Stream trait is for documentation, so I think either one is fine.

@mich2000
Copy link

Okay, I'll directly work on the stream size_hint implementation.

@mich2000
Copy link

PR: #967

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants