pub struct Sink<In, Mat> { /* private fields */ }Implementations§
Source§impl<In: Send + 'static, Mat: Send + 'static> Sink<In, Mat>
impl<In: Send + 'static, Mat: Send + 'static> Sink<In, Mat>
pub fn run_with<SourceMat: Send + 'static>( self, source: Source<In, SourceMat>, ) -> StreamResult<SourceMat>
pub fn run_with_materializer<SourceMat: Send + 'static>( self, source: Source<In, SourceMat>, materializer: &Materializer, ) -> StreamResult<SourceMat>
pub fn from_materializer<F>(factory: F) -> Self
pub fn setup<F>(factory: F) -> Self
pub fn pre_materialize( &self, materializer: &Materializer, ) -> StreamResult<(Mat, Sink<In, NotUsed>)>
pub fn map_materialized_value<NextMat, F>(self, f: F) -> Sink<In, NextMat>
pub fn attributes(&self) -> &Attributes
pub fn with_attributes(self, attributes: Attributes) -> Self
pub fn add_attributes(self, attributes: Attributes) -> Self
pub fn named(self, name: impl Into<String>) -> Self
Source§impl<In: Send + 'static> Sink<In, StreamCompletion<NotUsed>>
impl<In: Send + 'static> Sink<In, StreamCompletion<NotUsed>>
pub fn ignore() -> Self
pub fn on_complete<F>(callback: F) -> Self
pub fn never() -> Self
pub fn foreach<F>(f: F) -> Self
pub fn foreach_async<F, Fut>(parallelism: usize, f: F) -> Self
pub fn foreach_result<F>(f: F) -> Self
pub fn foreach_result_with_supervision<F>( f: F, decider: SupervisionDecider, ) -> Self
Source§impl<In: Send + 'static> Sink<In, StreamCompletion<In>>
impl<In: Send + 'static> Sink<In, StreamCompletion<In>>
Sourcepub fn head() -> Self
pub fn head() -> Self
Materializes a sink that completes with the stream’s first element, or
fails with StreamError::EmptyStream if the stream is empty.
Fed by a synchronous bounded eager source (Source::single/from_iter/
empty/failed, optionally through inline-preserving synchronous flows
such as map/filter/identity), this terminal takes the inline head
fast path: the first element is produced on the calling thread during
materialization, without spawning a worker or a oneshot channel. As a
result run_with_materializer() blocks until that element is available and
the returned StreamCompletion is already resolved, so any work a caller
expected to overlap between run_with_materializer() returning and
.wait() is already done for these sources. Other sources — and any chain
that passes through a non-preserving operator, including ActorFlow::ask
(whose blocking cross-thread reply wait must not run inline on the caller) —
still drain on a runtime worker as before, keeping the returned
StreamCompletion non-blocking/awaitable.
pub fn last() -> Self
pub fn reduce<F>(f: F) -> Self
pub fn reduce_result<F>(f: F) -> Self
pub fn reduce_result_with_supervision<F>( f: F, decider: SupervisionDecider, ) -> Self
Source§impl<In: Send + 'static> Sink<In, StreamCompletion<Option<In>>>
impl<In: Send + 'static> Sink<In, StreamCompletion<Option<In>>>
Sourcepub fn head_option() -> Self
pub fn head_option() -> Self
Materializes a sink that completes with Some(first element), or None
if the stream is empty.
Like Sink::head, fed by a synchronous bounded eager source
(Source::single/from_iter/empty/failed, optionally through
inline-preserving synchronous flows such as map/filter/identity) this
terminal takes the inline head fast path: the result is produced on the
calling thread during materialization without spawning a worker or a
oneshot channel, so run_with_materializer() blocks until it is available
and the returned StreamCompletion is already resolved. Any work a caller
expected to overlap between run_with_materializer() returning and
.wait() is already done for these sources; other sources — and any chain
through a non-preserving operator, including ActorFlow::ask (whose
blocking cross-thread reply wait must not run inline) — still drain on a
runtime worker, keeping the returned StreamCompletion
non-blocking/awaitable.