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

tokio::stream::timeout::Timeout is private #2188

Closed
krojew opened this issue Jan 28, 2020 · 6 comments
Closed

tokio::stream::timeout::Timeout is private #2188

krojew opened this issue Jan 28, 2020 · 6 comments
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-stream Module: tokio/stream

Comments

@krojew
Copy link

krojew commented Jan 28, 2020

Version

0.2.11

Platform

all

Subcrates

Description

tokio::stream::timeout::Timeout returned by StreamExt::timeout() is private, meaning you can't store the output type anywhere - you can only assign it to a local variable and use type inference, or use dynamic dispatch (which has obvious problems). It's now impossible to store the result e.g. in a struct.

@karlpvoss
Copy link
Contributor

+1 for this, I'd like to be able to store the output type/use it in type definitions.

@Darksonn Darksonn added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-stream Module: tokio/stream labels May 8, 2020
@karlpvoss
Copy link
Contributor

If this is as simple as marking the module as public I'm happy to do so. Not sure of the implications of that, very new to tokio.

krojew added a commit to krojew/tokio that referenced this issue May 15, 2020
@carllerche
Copy link
Member

Thanks for the feedback.

Could you clarify the use cases in which you need to store Timeout in a struct?

@krojew
Copy link
Author

krojew commented May 16, 2020

@carllerche in my particular case, I have a struct being a stream and a sink, which wraps an underlying stream and sink. The stream is required to time out if it does not receive a message within a given time frame. This is a perfect use case for the stream timeout function, but the result needs to be stored in the wrapper.

@Darksonn
Copy link
Contributor

We discussed this on discord. We would like to make this public, along with the other stream combinators (but not the futures). If you would like to submit a larger PR that marks the combinators as public and puts them in a sub-module of tokio::stream, that would be great!

@Darksonn
Copy link
Contributor

Closing in favor of #2723.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-stream Module: tokio/stream
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants