pub struct With<S, U, Fut, F>{ /* private fields */ }
Expand description
Sink for the Sink::with
combinator, chaining a computation to run prior
to pushing a value into the underlying sink.
Implementations§
Source§impl<S, U, Fut, F> With<S, U, Fut, F>where
S: Sink,
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = <S as Sink>::SinkItem>,
<Fut as IntoFuture>::Error: From<<S as Sink>::SinkError>,
impl<S, U, Fut, F> With<S, U, Fut, F>where
S: Sink,
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = <S as Sink>::SinkItem>,
<Fut as IntoFuture>::Error: From<<S as Sink>::SinkError>,
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes this combinator, returning the underlying sink.
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, U, Fut, F> Sink for With<S, U, Fut, F>where
S: Sink,
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = <S as Sink>::SinkItem>,
<Fut as IntoFuture>::Error: From<<S as Sink>::SinkError>,
impl<S, U, Fut, F> Sink for With<S, U, Fut, F>where
S: Sink,
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = <S as Sink>::SinkItem>,
<Fut as IntoFuture>::Error: From<<S as Sink>::SinkError>,
Source§type SinkError = <Fut as IntoFuture>::Error
type SinkError = <Fut as IntoFuture>::Error
The type of value produced by the sink when an error occurs.
Source§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Result<Async<()>, <With<S, U, Fut, F> as Sink>::SinkError>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Result<Async<()>, <With<S, U, Fut, F> as Sink>::SinkError>
Attempts to prepare the
Sink
to receive a value. Read moreSource§fn start_send(
&mut self,
item: <With<S, U, Fut, F> as Sink>::SinkItem,
) -> Result<(), <With<S, U, Fut, F> as Sink>::SinkError>
fn start_send( &mut self, item: <With<S, U, Fut, F> as Sink>::SinkItem, ) -> Result<(), <With<S, U, Fut, F> as Sink>::SinkError>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready
which returned Ok(Async::Ready(()))
. Read moreSource§impl<S, U, Fut, F> Stream for With<S, U, Fut, F>
impl<S, U, Fut, F> Stream for With<S, U, Fut, F>
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>
Attempt to pull out the next value of this stream, registering the
current task for wakeup if the value is not yet available, and returning
None
if the stream is exhausted. Read moreAuto Trait Implementations§
impl<S, U, Fut, F> Freeze for With<S, U, Fut, F>
impl<S, U, Fut, F> RefUnwindSafe for With<S, U, Fut, F>where
S: RefUnwindSafe,
F: RefUnwindSafe,
<Fut as IntoFuture>::Future: RefUnwindSafe,
<S as Sink>::SinkItem: RefUnwindSafe,
impl<S, U, Fut, F> Send for With<S, U, Fut, F>
impl<S, U, Fut, F> Sync for With<S, U, Fut, F>
impl<S, U, Fut, F> Unpin for With<S, U, Fut, F>
impl<S, U, Fut, F> UnwindSafe for With<S, U, Fut, F>where
S: UnwindSafe,
F: UnwindSafe,
<Fut as IntoFuture>::Future: UnwindSafe,
<S as Sink>::SinkItem: 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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> ⓘ
Converts
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> ⓘ
Converts
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,
Composes a function in front of the sink. Read more
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>
Composes a function in front of the sink. Read more
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>
Transforms the error returned by the sink.
Source§fn sink_err_into<E>(self) -> SinkErrInto<Self, E>
fn sink_err_into<E>(self) -> SinkErrInto<Self, E>
Map this sink’s error to a different error type using the
Into
trait. Read moreSource§fn buffer(self, amt: usize) -> Buffer<Self>where
Self: Sized,
fn buffer(self, amt: usize) -> Buffer<Self>where
Self: Sized,
Adds a fixed-size buffer to the current sink. Read more
Source§fn flush(self) -> Flush<Self>where
Self: Sized,
fn flush(self) -> Flush<Self>where
Self: Sized,
Flush the sync, processing all pending items. Read more
Source§fn send(self, item: Self::SinkItem) -> Send<Self>where
Self: Sized,
fn send(self, item: Self::SinkItem) -> Send<Self>where
Self: Sized,
A future that completes after the given item has been fully processed
into the sink, including flushing. Read more
Source§fn send_all<S>(self, stream: S) -> SendAll<Self, S>
fn send_all<S>(self, stream: S) -> SendAll<Self, S>
A future that completes after the given stream has been fully processed
into the sink, including flushing. Read more
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,
Converts this stream into a
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>
Filters the values produced by this stream according to the provided
predicate. Read more
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>
Filters the values produced by this stream while simultaneously mapping
them to a different type. Read more
Source§fn then<U, F>(self, f: F) -> Then<Self, U, F>
fn then<U, F>(self, f: F) -> Then<Self, U, F>
Chain on a computation for when a value is ready, passing the resulting
item to the provided closure
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>
Chain on a computation for when a value is ready, passing the successful
results to the provided closure
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>
Chain on a computation for when an error happens, passing the
erroneous result to the provided closure
f
. Read moreSource§fn collect<C>(self) -> Collect<Self, C>
fn collect<C>(self) -> Collect<Self, C>
Collect all of the values of this stream into a vector, returning a
future representing the result of that computation. Read more
Source§fn concat(self) -> Concat<Self>
fn concat(self) -> Concat<Self>
Concatenate all results of a stream into a single extendable
destination, returning a future representing the end result. Read more
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>
Execute an accumulating computation over a stream, collecting all the
values into one final result. Read more
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Flattens a stream of streams into just one continuous stream. Read more
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>
Skip elements on this stream while the predicate provided resolves to
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>
Take elements from this stream while the predicate provided resolves to
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>
Runs this stream to completion, executing the provided closure for each
element on the stream. Read more
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>
Runs this stream to completion, executing the provided closure for each
element on the stream. This is similar to
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>
Map this stream’s error to a different type using the
Into
trait. Read moreSource§fn take(self, amt: u64) -> Take<Self>where
Self: Sized,
fn take(self, amt: u64) -> Take<Self>where
Self: Sized,
Creates a new stream of at most
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,
Creates a new stream which skips
amt
items of the underlying stream. Read moreSource§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
Fuse a stream such that
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,
Borrows a stream, rather than consuming it. Read more
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Catches unwinding panics while polling the stream. Read more
Source§fn buffered(self, amt: usize) -> Buffered<Self>
fn buffered(self, amt: usize) -> Buffered<Self>
An adaptor for creating a buffered list of pending futures. Read more
Source§fn buffer_unordered(self, amt: usize) -> BufferUnordered<Self>
fn buffer_unordered(self, amt: usize) -> BufferUnordered<Self>
An adaptor for creating a buffered list of pending futures (unordered). Read more
Source§fn zip<S>(self, other: S) -> Zip<Self, S>
fn zip<S>(self, other: S) -> Zip<Self, S>
An adapter for zipping two streams together. Read more
Source§fn peekable(self) -> Peekable<Self>where
Self: Sized,
fn peekable(self) -> Peekable<Self>where
Self: Sized,
Creates a new stream which exposes a
peek
method. Read moreSource§fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
An adaptor for chunking up items of the stream inside a vector. Read more
Source§fn select<S>(self, other: S) -> Select<Self, S>
fn select<S>(self, other: S) -> Select<Self, S>
Creates a stream that selects the next element from either this stream
or the provided one, whichever is ready first. Read more
Source§fn forward<S>(self, sink: S) -> Forward<Self, S>
fn forward<S>(self, sink: S) -> Forward<Self, S>
A future that completes after the given stream has been fully processed
into the sink, including flushing. Read more
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>
Do something with each item of this stream, afterwards passing it on. Read more
Source§fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
Do something with the error of this stream, afterwards passing it on. Read more
Source§fn recover<E, F>(self, f: F) -> Recover<Self, E, F>
fn recover<E, F>(self, f: F) -> Recover<Self, E, F>
Handle errors generated by this stream by converting them into
Option<Self::Item>
, such that a None
value terminates the stream. Read more