Skip to content

Commit 9e56f99

Browse files
authored
Merge pull request rust-lang#200 from tmiasko/stream-fuse-docs
Update documentation for stream::fuse.
2 parents 4940e3f + 6c3dd3b commit 9e56f99

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/stream/fuse.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ use stream::Stream;
33

44
/// A stream which "fuse"s a stream once it's terminated.
55
///
6-
/// Normally streams can behave unpredictably after they've terminated or
7-
/// returned an error, but `Fuse` is always defined to return `None` from `poll`
8-
/// after terination/errors, and afterwards all calls to `schedule` will be
9-
/// ignored.
6+
/// Normally streams can behave unpredictably when used after they have already
7+
/// finished, but `Fuse` continues to return `None` from `poll` forever when
8+
/// finished.
109
#[must_use = "streams do nothing unless polled"]
1110
pub struct Fuse<S> {
1211
stream: Option<S>,
@@ -33,7 +32,7 @@ impl<S> Fuse<S> {
3332
/// Returns whether the underlying stream has finished or not.
3433
///
3534
/// If this method returns `true`, then all future calls to poll are
36-
/// guaranteed to return `NotReady`. If this returns `false`, then the
35+
/// guaranteed to return `None`. If this returns `false`, then the
3736
/// underlying stream is still in use.
3837
pub fn is_done(&self) -> bool {
3938
self.stream.is_none()

src/stream/mod.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -607,20 +607,18 @@ pub trait Stream {
607607
skip::new(self, amt)
608608
}
609609

610-
/// Fuse a stream such that `poll`/`schedule` will never again be called
611-
/// once it has terminated (signaled emptyness or an error).
610+
/// Fuse a stream such that `poll` will never again be called once it has
611+
/// finished.
612612
///
613-
/// Currently once a stream has returned `Some(Ok(None))` from `poll` any further
613+
/// Currently once a stream has returned `None` from `poll` any further
614614
/// calls could exhibit bad behavior such as block forever, panic, never
615-
/// return, etc. If it is known that `poll` may be called too often then
616-
/// this method can be used to ensure that it has defined semantics.
615+
/// return, etc. If it is known that `poll` may be called after stream has
616+
/// already finished, then this method can be used to ensure that it has
617+
/// defined semantics.
617618
///
618-
/// Once a stream has been `fuse`d and it terminates, then
619-
/// it will forever return `None` from `poll` again (never resolve). This,
620-
/// unlike the trait's `poll` method, is guaranteed.
621-
///
622-
/// Additionally, once a stream has completed, this `Fuse` combinator will
623-
/// never call `schedule` on the underlying stream.
619+
/// Once a stream has been `fuse`d and it finishes, then it will forever
620+
/// return `None` from `poll`. This, unlike for the traits `poll` method,
621+
/// is guaranteed.
624622
fn fuse(self) -> Fuse<Self>
625623
where Self: Sized
626624
{

0 commit comments

Comments
 (0)