-
Notifications
You must be signed in to change notification settings - Fork 653
Send a single stream to multiple sinks? #486
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
Comments
Here is the function on github: https://github.com/NickeZ/rups/blob/tokio-2/src/telnet_server.rs#L78 |
That.... looks like a rustc bug :) I would page @alexcrichton for this! |
btw, I also think the "summing" variable in the fold example should be named "summing" instead of "a". It is not possible to see if it is "a" or "b" that is the sum variable. https://docs.rs/futures/0.1.13/futures/stream/trait.Stream.html#method.fold |
Fails on stable, beta and nightly: https://travis-ci.org/NickeZ/rups |
The tipical name for that is accumulator, shortened as |
The rustc error here may be similar to rust-lang/rust#40274, although I don't recognize it off hand :( |
I got around the compiler error by simply adding features to I don't understand how I should gracefully indicate that my sink cannot receive more items. It seems like the only way is to return an error. But if I return an error |
@NickeZ ah yeah right now most standard combinators throw away intermediate state on errors, so if you need to preserve state on an error you may need to copy the combinator locally to tweak its implementation. |
@alexcrichton thanks for pointing me in the right direction. I now have a working fork of SendAll that returns whether the stream or the sink ended instead of erroring. I'm not sure if this is useful to you. Anyway here is the code: https://github.com/NickeZ/toy-tokio/blob/master/src/main.rs |
Ok sounds like ICEs and functionality have been resolved/worked around, so yay! In that case I'm going to close this, but please let me know if that's in error! |
Hey,
So I have an
mpsc
where I named the stream endpointrx
and then I have a stream of sinks. I want to stream fromrx
to every sink in the order they come. So I stream to the first sink untilsend_start
returns an error and then I continue to stream to the second sink untilsend_start
returns an error and so on. I'm obviously a noob at tokio and maybe what I'm trying to do is really weird or completely wrong..So the code is something like this:
But I get the following compiler error:
The text was updated successfully, but these errors were encountered: