-
Notifications
You must be signed in to change notification settings - Fork 26
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
v2.4.0 #102
v2.4.0 #102
Conversation
|
Good catch! I forgot to check the equivalent Iterator method, I'll fix. |
Actually, on second check I think it's intentional. The idea is "run a stream in parallel with a future and stop the stream when the future stops." I think the idea is this: let my_stream = /* ... */;
let (signal, shutdown) = async_channel::bounded::<()>(1);
// Send the shutdown signal when the user hits ctrl-c.
executor.spawn(async move {
wait_for_user_to_hit_ctrl_c().await;
signal.try_send(()).ok();
}).detach();
// Run until the stream stops.
while let Some(item) = stream::take_until(my_stream, shutdown).next().await {
do_something(item).await;
} |
(Honestly, I have no strong opinion on which API to choose here. I just know what the result of inconsistent APIs can be: rust-lang/futures-rs#2755) |
I think it's not an inconsistent API, since it's somewhat |
I think the name is the core point of confusion here. I've opened #104 to address this. |
I've changed the name, |
@smol-rs/admins Can someone take a look at this? |
8e9fcd8
to
e0aed29
Compare
Fixed! |
Signed-off-by: John Nunley <[email protected]>
Future
returnsPoll::Pending
forever after it returns
Poll::Pending
once. (add Fuse support to FutureExt #101)Stream
until aFuture
completes. (feat: addStreamExt::take_until
. #103)