pub struct Fuse<S> { /* private fields */ }
Expand description
A stream which “fuse“s a stream once it’s terminated.
Normally streams can behave unpredictably when used after they have already
finished, but Fuse
continues to return None
from poll
forever when
finished.
Implementations§
Source§impl<S> Fuse<S>
impl<S> Fuse<S>
Sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
Returns whether the underlying stream has finished or not.
If this method returns true
, then all future calls to poll are
guaranteed to return None
. If this returns false
, then the
underlying stream is still in use.
Sourcepub fn get_ref(&self) -> &S
pub fn get_ref(&self) -> &S
Acquires a reference to the underlying stream that this combinator is pulling from.
Sourcepub fn get_mut(&mut self) -> &mut S
pub fn get_mut(&mut self) -> &mut S
Acquires a mutable reference to the underlying stream that this combinator is pulling from.
Note that care must be taken to avoid tampering with the state of the stream which may otherwise confuse this combinator.
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes this combinator, returning the underlying stream.
Note that this may discard intermediate state of this combinator, so care should be taken to avoid losing resources when this is called.
Trait Implementations§
Source§impl<S> Sink for Fuse<S>where
S: Sink,
impl<S> Sink for Fuse<S>where
S: Sink,
Source§type SinkError = <S as Sink>::SinkError
type SinkError = <S as Sink>::SinkError
Source§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Result<Async<()>, <Fuse<S> as Sink>::SinkError>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Result<Async<()>, <Fuse<S> as Sink>::SinkError>
Sink
to receive a value. Read moreSource§fn start_send(
&mut self,
item: <Fuse<S> as Sink>::SinkItem,
) -> Result<(), <Fuse<S> as Sink>::SinkError>
fn start_send( &mut self, item: <Fuse<S> as Sink>::SinkItem, ) -> Result<(), <Fuse<S> as Sink>::SinkError>
poll_ready
which returned Ok(Async::Ready(()))
. Read moreSource§impl<S> Stream for Fuse<S>where
S: Stream,
impl<S> Stream for Fuse<S>where
S: Stream,
Source§fn poll_next(
&mut self,
cx: &mut Context<'_>,
) -> Result<Async<Option<<S as Stream>::Item>>, <S as Stream>::Error>
fn poll_next( &mut self, cx: &mut Context<'_>, ) -> Result<Async<Option<<S as Stream>::Item>>, <S as Stream>::Error>
None
if the stream is exhausted. Read moreAuto Trait Implementations§
impl<S> Freeze for Fuse<S>where
S: Freeze,
impl<S> RefUnwindSafe for Fuse<S>where
S: RefUnwindSafe,
impl<S> Send for Fuse<S>where
S: Send,
impl<S> Sync for Fuse<S>where
S: Sync,
impl<S> Unpin for Fuse<S>where
S: Unpin,
impl<S> UnwindSafe for Fuse<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> SinkExt for T
impl<T> SinkExt for T
Source§fn with<U, Fut, F>(self, f: F) -> With<Self, U, Fut, F>where
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = Self::SinkItem>,
<Fut as IntoFuture>::Error: From<Self::SinkError>,
Self: Sized,
fn with<U, Fut, F>(self, f: F) -> With<Self, U, Fut, F>where
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = Self::SinkItem>,
<Fut as IntoFuture>::Error: From<Self::SinkError>,
Self: Sized,
Source§fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, U, St, F>
fn with_flat_map<U, St, F>(self, f: F) -> WithFlatMap<Self, U, St, F>
Source§fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>
fn sink_map_err<E, F>(self, f: F) -> SinkMapErr<Self, F>
Source§fn sink_err_into<E>(self) -> SinkErrInto<Self, E>
fn sink_err_into<E>(self) -> SinkErrInto<Self, E>
Into
trait. Read moreSource§fn buffer(self, amt: usize) -> Buffer<Self>where
Self: Sized,
fn buffer(self, amt: usize) -> Buffer<Self>where
Self: Sized,
Source§fn flush(self) -> Flush<Self>where
Self: Sized,
fn flush(self) -> Flush<Self>where
Self: Sized,
Source§fn send(self, item: Self::SinkItem) -> Send<Self>where
Self: Sized,
fn send(self, item: Self::SinkItem) -> Send<Self>where
Self: Sized,
Source§fn send_all<S>(self, stream: S) -> SendAll<Self, S>
fn send_all<S>(self, stream: S) -> SendAll<Self, S>
Source§impl<T> StreamExt for T
impl<T> StreamExt for T
Source§fn next(self) -> StreamFuture<Self>where
Self: Sized,
fn next(self) -> StreamFuture<Self>where
Self: Sized,
Future
. Read moreSource§fn filter<R, P>(self, pred: P) -> Filter<Self, R, P>
fn filter<R, P>(self, pred: P) -> Filter<Self, R, P>
Source§fn filter_map<R, B, F>(self, f: F) -> FilterMap<Self, R, F>
fn filter_map<R, B, F>(self, f: F) -> FilterMap<Self, R, F>
Source§fn then<U, F>(self, f: F) -> Then<Self, U, F>
fn then<U, F>(self, f: F) -> Then<Self, U, F>
f
. Read moreSource§fn and_then<U, F>(self, f: F) -> AndThen<Self, U, F>
fn and_then<U, F>(self, f: F) -> AndThen<Self, U, F>
f
. Read moreSource§fn or_else<U, F>(self, f: F) -> OrElse<Self, U, F>
fn or_else<U, F>(self, f: F) -> OrElse<Self, U, F>
f
. Read moreSource§fn collect<C>(self) -> Collect<Self, C>
fn collect<C>(self) -> Collect<Self, C>
Source§fn concat(self) -> Concat<Self>
fn concat(self) -> Concat<Self>
Source§fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F>
fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F>
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn skip_while<R, P>(self, pred: P) -> SkipWhile<Self, R, P>
fn skip_while<R, P>(self, pred: P) -> SkipWhile<Self, R, P>
true
. Read moreSource§fn take_while<R, P>(self, pred: P) -> TakeWhile<Self, R, P>
fn take_while<R, P>(self, pred: P) -> TakeWhile<Self, R, P>
true
. Read moreSource§fn for_each<U, F>(self, f: F) -> ForEach<Self, U, F>
fn for_each<U, F>(self, f: F) -> ForEach<Self, U, F>
Source§fn for_each_concurrent<U, F>(self, f: F) -> ForEachConcurrent<Self, U, F>
fn for_each_concurrent<U, F>(self, f: F) -> ForEachConcurrent<Self, U, F>
for_each
but may begin
processing an element while previous elements are still being processed. Read moreSource§fn err_into<E>(self) -> ErrInto<Self, E>
fn err_into<E>(self) -> ErrInto<Self, E>
Into
trait. Read moreSource§fn take(self, amt: u64) -> Take<Self>where
Self: Sized,
fn take(self, amt: u64) -> Take<Self>where
Self: Sized,
amt
items of the underlying stream. Read moreSource§fn skip(self, amt: u64) -> Skip<Self>where
Self: Sized,
fn skip(self, amt: u64) -> Skip<Self>where
Self: Sized,
amt
items of the underlying stream. Read moreSource§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll
will never again be called once it has
finished. Read moreSource§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn buffered(self, amt: usize) -> Buffered<Self>
fn buffered(self, amt: usize) -> Buffered<Self>
Source§fn buffer_unordered(self, amt: usize) -> BufferUnordered<Self>
fn buffer_unordered(self, amt: usize) -> BufferUnordered<Self>
Source§fn zip<S>(self, other: S) -> Zip<Self, S>
fn zip<S>(self, other: S) -> Zip<Self, S>
Source§fn peekable(self) -> Peekable<Self>where
Self: Sized,
fn peekable(self) -> Peekable<Self>where
Self: Sized,
peek
method. Read moreSource§fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
Source§fn select<S>(self, other: S) -> Select<Self, S>
fn select<S>(self, other: S) -> Select<Self, S>
Source§fn forward<S>(self, sink: S) -> Forward<Self, S>
fn forward<S>(self, sink: S) -> Forward<Self, S>
Source§fn split(self) -> (SplitSink<Self>, SplitStream<Self>)
fn split(self) -> (SplitSink<Self>, SplitStream<Self>)
Source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
Source§fn recover<E, F>(self, f: F) -> Recover<Self, E, F>
fn recover<E, F>(self, f: F) -> Recover<Self, E, F>
Option<Self::Item>
, such that a None
value terminates the stream. Read more