Struct TakeUntil
#[must_use = "streams do nothing unless polled"]
pub struct TakeUntil<St: Stream, Fut: Future> { /* private fields */ }
Stream for the take_until method.
Implementations
impl<St, Fut> TakeUntil<St, Fut>
where
St: Stream,
Fut: Future,
fn get_ref(&self) -> &StAcquires a reference to the underlying sink or stream that this combinator is pulling from.
fn get_mut(&mut self) -> &mut StAcquires a mutable reference to the underlying sink or stream that this combinator is pulling from.
Note that care must be taken to avoid tampering with the state of the sink or stream which may otherwise confuse this combinator.
fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut St>Acquires a pinned mutable reference to the underlying sink or stream that this combinator is pulling from.
Note that care must be taken to avoid tampering with the state of the sink or stream which may otherwise confuse this combinator.
fn into_inner(self) -> StConsumes this combinator, returning the underlying sink or stream.
Note that this may discard intermediate state of this combinator, so care should be taken to avoid losing resources when this is called.
fn take_future(&mut self) -> Option<Fut>Extract the stopping future out of the combinator. The future is returned only if it isn't resolved yet, ie. if the stream isn't stopped yet. Taking out the future means the combinator will be yielding elements from the wrapped stream without ever stopping it.
fn take_result(&mut self) -> Option<Fut::Output>Once the stopping future is resolved, this method can be used to extract the value returned by the stopping future.
This may be used to retrieve arbitrary data from the stopping future, for example a reason why the stream was stopped.
This method will return
Noneif the future isn't resolved yet, or if the result was already taken out.Examples
# block_on;fn is_stopped(&self) -> boolWhether the stream was stopped yet by the stopping future being resolved.
Trait Implementations
impl<'__pin, St: Stream, Fut: Future> Unpin for TakeUntil<St, Fut>
where
PinnedFieldsOf<__Origin<'__pin, St, Fut>>: Unpin,
impl<S, Fut, Item> Sink<Item> for TakeUntil<S, Fut>
where
S: Stream + Sink<Item>,
Fut: Future,
type Error = <S as Sink<Item>>::Error;fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn start_send(self: Pin<&mut Self>, item: Item) -> Result<(), Self::Error>fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
impl<St, Fut> Debug for TakeUntil<St, Fut>
where
St: Stream + Debug,
St::Item: Debug,
Fut: Future + Debug,
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<St, Fut> FusedStream for TakeUntil<St, Fut>
where
St: Stream,
Fut: Future,
fn is_terminated(&self) -> bool
impl<St, Fut> Stream for TakeUntil<St, Fut>
where
St: Stream,
Fut: Future,
type Item = <St as Stream>::Item;fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<St::Item>>fn size_hint(&self) -> (usize, Option<usize>)
Auto Trait Implementations
impl<St, Fut> Freeze for TakeUntil<St, Fut>
where
St: Freeze,
Option<Fut>: Freeze,
Option<<Fut as Future>::Output>: Freeze,
impl<St, Fut> RefUnwindSafe for TakeUntil<St, Fut>
where
St: RefUnwindSafe,
Option<Fut>: RefUnwindSafe,
Option<<Fut as Future>::Output>: RefUnwindSafe,
impl<St, Fut> Send for TakeUntil<St, Fut>
where
St: Send,
Option<Fut>: Send,
Option<<Fut as Future>::Output>: Send,
impl<St, Fut> Sync for TakeUntil<St, Fut>
where
St: Sync,
Option<Fut>: Sync,
Option<<Fut as Future>::Output>: Sync,
impl<St, Fut> UnsafeUnpin for TakeUntil<St, Fut>
where
St: UnsafeUnpin,
Option<Fut>: UnsafeUnpin,
Option<<Fut as Future>::Output>: UnsafeUnpin,
impl<St, Fut> UnwindSafe for TakeUntil<St, Fut>
where
St: UnwindSafe,
Option<Fut>: UnwindSafe,
Option<<Fut as Future>::Output>: UnwindSafe,
Blanket Implementations
impl<S> TryStreamExt for TakeUntil<St, Fut>
where
S: TryStream + ?Sized,
impl<S, T, E> TryStream for TakeUntil<St, Fut>
where
S: Stream<Item = Result<T, E>> + ?Sized,
type Ok = T;type Error = E;fn try_poll_next(self: Pin<&mut S>, cx: &mut Context<'_>) -> Poll<Option<Result<<S as TryStream>::Ok, <S as TryStream>::Error>>>
impl<T> Any for TakeUntil<St, Fut>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for TakeUntil<St, Fut>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for TakeUntil<St, Fut>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for TakeUntil<St, Fut>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> StreamExt for TakeUntil<St, Fut>
where
T: Stream + ?Sized,
impl<T, Item> SinkExt<Item> for TakeUntil<St, Fut>
where
T: Sink<Item> + ?Sized,
impl<T, U> Into<U> for TakeUntil<St, Fut>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for TakeUntil<St, Fut>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for TakeUntil<St, Fut>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>