pub struct ActorSink;Expand description
Collection of actor-backed sink constructors.
Implementations§
Source§impl ActorSink
impl ActorSink
Sourcepub fn actor_ref<In, Msg, Elem, Complete, Failure>(
actor_ref: ActorRef<Msg>,
make_element_message: Elem,
on_complete_message: Complete,
on_failure_message: Failure,
) -> Sink<In, StreamCompletion<NotUsed>>
pub fn actor_ref<In, Msg, Elem, Complete, Failure>( actor_ref: ActorRef<Msg>, make_element_message: Elem, on_complete_message: Complete, on_failure_message: Failure, ) -> Sink<In, StreamCompletion<NotUsed>>
Sends stream elements to actor_ref without waiting for an actor ack.
§Mailbox risk
This sink has no backpressure signal from the destination actor. A fast
upstream can enqueue messages faster than the actor processes them, so
the target actor’s mailbox may grow without bound. Use
ActorSink::actor_ref_with_backpressure for slow or untrusted
consumers.
Sourcepub fn typed<In>(
actor_ref: ActorRef<ActorSinkMessage<In>>,
) -> Sink<In, StreamCompletion<NotUsed>>where
In: Send + 'static,
pub fn typed<In>(
actor_ref: ActorRef<ActorSinkMessage<In>>,
) -> Sink<In, StreamCompletion<NotUsed>>where
In: Send + 'static,
Sends stream elements using ActorSinkMessage.
§Mailbox risk
This is the typed-protocol form of ActorSink::actor_ref and has the
same unbounded-mailbox risk.
Sourcepub fn actor_ref_with_backpressure<In, Msg, Ack, Init, Elem, Complete, Failure>(
actor_ref: ActorRef<Msg>,
timeout: Duration,
make_init_message: Init,
make_element_message: Elem,
on_complete_message: Complete,
on_failure_message: Failure,
) -> Sink<In, StreamCompletion<NotUsed>>
pub fn actor_ref_with_backpressure<In, Msg, Ack, Init, Elem, Complete, Failure>( actor_ref: ActorRef<Msg>, timeout: Duration, make_init_message: Init, make_element_message: Elem, on_complete_message: Complete, on_failure_message: Failure, ) -> Sink<In, StreamCompletion<NotUsed>>
Sends an init message, then sends one element per actor ack.
make_init_message and make_element_message receive a ReplyPort.
The destination actor must send any value to that port to acknowledge
readiness for the next message. Completion and failure messages are sent
without waiting for an ack.
Sourcepub fn typed_with_backpressure<In, Ack>(
actor_ref: ActorRef<ActorSinkBackpressureMessage<In, Ack>>,
timeout: Duration,
) -> Sink<In, StreamCompletion<NotUsed>>
pub fn typed_with_backpressure<In, Ack>( actor_ref: ActorRef<ActorSinkBackpressureMessage<In, Ack>>, timeout: Duration, ) -> Sink<In, StreamCompletion<NotUsed>>
Backpressured typed-protocol sink.