Skip to main content

Sink

Struct Sink 

Source
pub struct Sink<In, Mat> { /* private fields */ }

Implementations§

Source§

impl<T: Send + 'static> Sink<T, SinkQueue<T>>

Source

pub fn queue() -> Self

Source§

impl<In: Send + 'static, Mat: Send + 'static> Sink<In, Mat>

Source

pub fn run_with<SourceMat: Send + 'static>( self, source: Source<In, SourceMat>, ) -> StreamResult<SourceMat>

Source

pub fn run_with_materializer<SourceMat: Send + 'static>( self, source: Source<In, SourceMat>, materializer: &Materializer, ) -> StreamResult<SourceMat>

Source

pub fn from_materializer<F>(factory: F) -> Self
where F: Fn(&Materializer, &Attributes) -> Sink<In, Mat> + Send + Sync + 'static,

Source

pub fn setup<F>(factory: F) -> Self
where F: Fn(&Materializer, &Attributes) -> Sink<In, Mat> + Send + Sync + 'static,

Source

pub fn pre_materialize( &self, materializer: &Materializer, ) -> StreamResult<(Mat, Sink<In, NotUsed>)>

Source

pub fn map_materialized_value<NextMat, F>(self, f: F) -> Sink<In, NextMat>
where NextMat: Send + 'static, F: Fn(Mat) -> NextMat + Send + Sync + 'static,

Source

pub fn attributes(&self) -> &Attributes

Source

pub fn with_attributes(self, attributes: Attributes) -> Self

Source

pub fn add_attributes(self, attributes: Attributes) -> Self

Source

pub fn named(self, name: impl Into<String>) -> Self

Source§

impl<In: Clone + Send + 'static> Sink<In, NotUsed>

Source

pub fn combine<M1, M2, MRest, I>( first: Sink<In, M1>, second: Sink<In, M2>, rest: I, strategy: SinkCombineStrategy, ) -> Sink<In, NotUsed>
where M1: Send + 'static, M2: Send + 'static, MRest: Send + 'static, I: IntoIterator<Item = Sink<In, MRest>>,

Source§

impl<In: Send + 'static> Sink<In, StreamCompletion<Vec<In>>>

Source

pub fn collect() -> Self

Source

pub fn collection() -> Self

Source

pub fn take_last(n: usize) -> Self

Source§

impl<In: Send + 'static> Sink<In, StreamCompletion<NotUsed>>

Source

pub fn ignore() -> Self

Source

pub fn on_complete<F>(callback: F) -> Self
where F: FnOnce() + Send + Sync + 'static,

Source

pub fn never() -> Self

Source

pub fn foreach<F>(f: F) -> Self
where F: Fn(In) + Send + Sync + 'static,

Source

pub fn foreach_async<F, Fut>(parallelism: usize, f: F) -> Self
where F: Fn(In) -> Fut + Send + Sync + 'static, Fut: Future<Output = StreamResult<()>> + Send + 'static,

Source

pub fn foreach_result<F>(f: F) -> Self
where F: Fn(In) -> StreamResult<()> + Send + Sync + 'static,

Source

pub fn foreach_result_with_supervision<F>( f: F, decider: SupervisionDecider, ) -> Self
where F: Fn(In) -> StreamResult<()> + Send + Sync + 'static,

Source§

impl<In: Send + 'static> Sink<In, StreamCompletion<In>>

Source

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.

Source

pub fn last() -> Self

Source

pub fn reduce<F>(f: F) -> Self
where F: Fn(In, In) -> In + Send + Sync + 'static,

Source

pub fn reduce_result<F>(f: F) -> Self
where F: Fn(In, In) -> StreamResult<In> + Send + Sync + 'static,

Source

pub fn reduce_result_with_supervision<F>( f: F, decider: SupervisionDecider, ) -> Self
where In: Clone, F: Fn(In, In) -> StreamResult<In> + Send + Sync + 'static,

Source§

impl<In: Send + 'static> Sink<In, StreamCompletion<Option<In>>>

Source

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.

Source

pub fn last_option() -> Self

Source§

impl<In: Send + 'static> Sink<In, NotUsed>

Source

pub fn cancelled() -> Self

Source

pub fn future_sink<InnerMat, F, Fut>( future: F, ) -> Sink<In, StreamCompletion<InnerMat>>
where InnerMat: Send + 'static, F: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = StreamResult<Sink<In, InnerMat>>> + Send + 'static,

Source

pub fn lazy_sink<InnerMat, F>(create: F) -> Sink<In, StreamCompletion<InnerMat>>
where InnerMat: Send + 'static, F: Fn() -> Sink<In, InnerMat> + Send + Sync + 'static,

Source

pub fn lazy_future_sink<InnerMat, F, Fut>( create: F, ) -> Sink<In, StreamCompletion<InnerMat>>
where InnerMat: Send + 'static, F: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = StreamResult<Sink<In, InnerMat>>> + Send + 'static,

Source

pub fn fold<Acc, F>(zero: Acc, f: F) -> Sink<In, StreamCompletion<Acc>>
where Acc: Clone + Send + Sync + 'static, F: Fn(Acc, In) -> Acc + Send + Sync + 'static,

Source

pub fn fold_result<Acc, F>(zero: Acc, f: F) -> Sink<In, StreamCompletion<Acc>>
where Acc: Clone + Send + Sync + 'static, F: Fn(Acc, In) -> StreamResult<Acc> + Send + Sync + 'static,

Source

pub fn fold_result_with_supervision<Acc, F>( zero: Acc, f: F, decider: SupervisionDecider, ) -> Sink<In, StreamCompletion<Acc>>
where Acc: Clone + Send + Sync + 'static, F: Fn(Acc, In) -> StreamResult<Acc> + Send + Sync + 'static,

Trait Implementations§

Source§

impl<In, Mat> Clone for Sink<In, Mat>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<In, Mat> !RefUnwindSafe for Sink<In, Mat>

§

impl<In, Mat> !UnwindSafe for Sink<In, Mat>

§

impl<In, Mat> Freeze for Sink<In, Mat>

§

impl<In, Mat> Send for Sink<In, Mat>

§

impl<In, Mat> Sync for Sink<In, Mat>

§

impl<In, Mat> Unpin for Sink<In, Mat>

§

impl<In, Mat> UnsafeUnpin for Sink<In, Mat>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Message for T
where T: Any + Send + 'static,

Source§

fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>

Convert a BoxedMessage to this concrete type
Source§

fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>

Convert this message to a BoxedMessage
Source§

impl<T> OutputMessage for T
where T: Message + Clone,

Source§

impl<T> State for T
where T: Any + Send + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more