Github Abortable streams by ibraheemdev · Pull Request #2410 · rust-lang/futures...
source link: https://github.com/rust-lang/futures-rs/pull/2410
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Thanks! This looks good to me!
Is there a better place to put
Abortable
thanfutures-util/src/abortable.rs
? Maybe ashared/
folder?
shared/
is confusing with future/shared
, so I think futures-util/src/abortable.rs
is fine.
Outdated
/// # use futures::stream::{self, StreamExt};
///
/// let (abort_handle, abort_registration) = AbortHandle::new_pair();
/// let mut stream = Abortable::stream(stream::iter(vec![1, 2, 3]), abort_registration);
taiki-e on May 6
Member
This function doesn't seem to exist, but I think it's not actually a bad idea to have both Abortable::new
(require T: Future
) and Abortable::stream
(require T: Stream
) because we can prevent the creation of Abortables that cannot be polled. -- However, it may feel redundant when we provide other abortables (e.g., abortable sink) in the future.
ibraheemdev on May 6
Author
Contributor
At first I wrote Abortable::new
and stream
, but I thought that new
for abortable futures specifically was a bit arbitrary.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK