Skip to content

Commit

Permalink
docs: document map_while is not fused
Browse files Browse the repository at this point in the history
  • Loading branch information
nanoqsh authored and notgull committed Nov 11, 2024
1 parent 24e3424 commit b93376f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,10 @@ pub trait StreamExt: Stream {

/// Maps items while `predicate` returns [`Some`].
///
/// This stream is not fused. After the predicate returns [`None`] the stream still
/// contains remaining items that can be obtained by subsequent `next` calls.
/// You can [`fuse`](StreamExt::fuse) the stream if this behavior is undesirable.
///
/// # Examples
///
/// ```
Expand All @@ -1151,6 +1155,10 @@ pub trait StreamExt: Stream {
/// assert_eq!(s.next().await, Some(0));
/// assert_eq!(s.next().await, Some(1));
/// assert_eq!(s.next().await, None);
///
/// // Continue to iterate the stream.
/// assert_eq!(s.next().await, Some(2));
/// assert_eq!(s.next().await, None);
/// # });
/// ```
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
Expand Down

0 comments on commit b93376f

Please sign in to comment.