pub struct ActorBuilder<T, A: ActorState> { /* private fields */ }
Expand description
Holds a type that implements ActorState
, helps aggregate all data that the actor needs, and
then launches the async actor process. When the actor process is launched, a client is returned
to the caller. This client’s type depends on the actor’s type.
Implementations§
Source§impl<T, A> ActorBuilder<T, A>where
A: ActorState<ActorType = T>,
impl<T, A> ActorBuilder<T, A>where
A: ActorState<ActorType = T>,
Sourcepub fn attach_stream<S, I>(&mut self, stream: S)
pub fn attach_stream<S, I>(&mut self, stream: S)
Attaches a stream that will be used by the actor once its spawned. No messages will be processed until after the actor is launched.
Source§impl<A> ActorBuilder<SinkActor, A>where
A: ActorState<ActorType = SinkActor>,
impl<A> ActorBuilder<SinkActor, A>where
A: ActorState<ActorType = SinkActor>,
Sourcepub fn client(&self) -> SinkClient<A::Permanence, A::Message>
pub fn client(&self) -> SinkClient<A::Permanence, A::Message>
Returns a client for the actor that will be spawned. While the returned client will be able to send messages, those messages will not be processed until after the actor is launched by the builder.
Sourcepub fn launch(self) -> SinkClient<A::Permanence, A::Message>
pub fn launch(self) -> SinkClient<A::Permanence, A::Message>
Launches an actor that uses the given state and returns a client to the actor.
Source§impl<A> ActorBuilder<StreamActor, A>where
A: ActorState<ActorType = StreamActor>,
impl<A> ActorBuilder<StreamActor, A>where
A: ActorState<ActorType = StreamActor>,
Sourcepub fn client(&mut self) -> StreamClient<A::Output>
pub fn client(&mut self) -> StreamClient<A::Output>
Returns a client for the actor that will be spawned. The client will not yield any messages until after the actor is launched and has sent a message.
Sourcepub fn launch<S>(self, stream: S) -> StreamClient<A::Output>where
S: SendableFusedStream<Item = A::Message>,
pub fn launch<S>(self, stream: S) -> StreamClient<A::Output>where
S: SendableFusedStream<Item = A::Message>,
Launches an actor that uses the given state. Returns a client to the actor.
Source§impl<A> ActorBuilder<JointActor, A>where
A: ActorState<ActorType = JointActor>,
impl<A> ActorBuilder<JointActor, A>where
A: ActorState<ActorType = JointActor>,
Sourcepub fn stream_client(&self) -> StreamClient<A::Output>
pub fn stream_client(&self) -> StreamClient<A::Output>
Returns a stream client for the actor that will be spawned. The client will not yield any messages until after the actor is launched and has sent a message.
Sourcepub fn sink_client(&self) -> SinkClient<A::Permanence, A::Message>
pub fn sink_client(&self) -> SinkClient<A::Permanence, A::Message>
Returns a sink client for the actor that will be spawned. While the returned client will be able to send messages, those messages will not be processed until after the actor is launched by the builder.
Sourcepub fn client(&self) -> SinkClient<A::Permanence, A::Message>
pub fn client(&self) -> SinkClient<A::Permanence, A::Message>
Returns a joint client for the actor that will be spawned. While the returned client will be able to send messages, those messages will not be processed until after the actor is launched by the builder. The client will also not yield any messages until after the actor is launched and has sent a message.
Sourcepub fn launch_with_stream<S>(
self,
stream: S,
) -> JointClient<A::Permanence, A::Message, A::Output>where
S: SendableFusedStream<Item = A::Message>,
pub fn launch_with_stream<S>(
self,
stream: S,
) -> JointClient<A::Permanence, A::Message, A::Output>where
S: SendableFusedStream<Item = A::Message>,
Launches an actor that uses the given state and stream. Returns a client to the actor.
Sourcepub fn launch(self) -> JointClient<A::Permanence, A::Message, A::Output>
pub fn launch(self) -> JointClient<A::Permanence, A::Message, A::Output>
Launches an actor that uses the given state. Returns a client to the actor.