Struct fluxion::actor::context::ActorContext
source · pub struct ActorContext<C: FluxionParams> { /* private fields */ }
Expand description
ActorContext
Provides information about an actor, as well as an interface to the system.
ActorContext
implements the System
trait, which means that it can be used anywhere that
a Fluxion
instance can. It should be noted that any message sent by actor handles returned by this struct
will be detected by the receiving actor as being sent by this actor. This may cause undesired behavior,
so as a rule of thumb, actor handles should not escape the actor that created them.
Generics
This struct takes a single generic which contains configuration data used by the Fluxion
system,
as well as other parts of fluxion.
Implementations§
source§impl<C: FluxionParams> ActorContext<C>
impl<C: FluxionParams> ActorContext<C>
Trait Implementations§
source§impl<C: FluxionParams> System<C> for ActorContext<C>
impl<C: FluxionParams> System<C> for ActorContext<C>
source§fn add<'life0, 'life1, 'async_trait, A>(
&'life0 self,
actor: A,
id: &'life1 str
) -> Pin<Box<dyn Future<Output = Option<LocalHandle<C, A>>> + Send + 'async_trait>>where
A: 'async_trait + Actor<C>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add<'life0, 'life1, 'async_trait, A>( &'life0 self, actor: A, id: &'life1 str ) -> Pin<Box<dyn Future<Output = Option<LocalHandle<C, A>>> + Send + 'async_trait>>where A: 'async_trait + Actor<C>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Add an actor to the system
Delegates to the Fluxion
instance’s internal add function, specifying the actor
that owns the context as the owner of the returned handle.
See System::add
for more info.
source§fn foreign_proxy<'life0, 'life1, 'life2, 'async_trait, A, M, R>(
&'life0 self,
actor_id: &'life1 str,
foreign_id: &'life2 str
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
A: Handler<C, M> + 'async_trait,
M: Message<Response = R> + Serialize + for<'a> Deserialize<'a> + 'async_trait,
R: Send + Sync + 'static + Serialize + for<'a> Deserialize<'a> + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn foreign_proxy<'life0, 'life1, 'life2, 'async_trait, A, M, R>( &'life0 self, actor_id: &'life1 str, foreign_id: &'life2 str ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where A: Handler<C, M> + 'async_trait, M: Message<Response = R> + Serialize + for<'a> Deserialize<'a> + 'async_trait, R: Send + Sync + 'static + Serialize + for<'a> Deserialize<'a> + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Delegated directly to System::foreign_proxy
, implemented on Fluxion
.
See System::foreign_proxy
for more info.
source§fn get_local<'life0, 'life1, 'async_trait, A>(
&'life0 self,
id: &'life1 str
) -> Pin<Box<dyn Future<Output = Option<LocalHandle<C, A>>> + Send + 'async_trait>>where
A: 'async_trait + Actor<C>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_local<'life0, 'life1, 'async_trait, A>( &'life0 self, id: &'life1 str ) -> Pin<Box<dyn Future<Output = Option<LocalHandle<C, A>>> + Send + 'async_trait>>where A: 'async_trait + Actor<C>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Get a local actor as a LocalHandle
. Useful for running management functions like shutdown
on known local actors.
Delegates to the Fluxion
instance’s internal get_local function, specifying the actor
that owns the context as the owner of the returned handle.
See System::get_local
for more info.
source§fn get<'life0, 'async_trait, A, M>(
&'life0 self,
id: ActorId
) -> Pin<Box<dyn Future<Output = Option<Box<dyn MessageSender<M>>>> + Send + 'async_trait>>where
M::Response: for<'a> Deserialize<'a>,
A: 'async_trait + Handler<C, M>,
M: 'async_trait + Message + Serialize,
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait, A, M>( &'life0 self, id: ActorId ) -> Pin<Box<dyn Future<Output = Option<Box<dyn MessageSender<M>>>> + Send + 'async_trait>>where M::Response: for<'a> Deserialize<'a>, A: 'async_trait + Handler<C, M>, M: 'async_trait + Message + Serialize, Self: 'async_trait, 'life0: 'async_trait,
Get an actor from its id as a Box<dyn MessageSender>
.
Use this for most cases, as it will also handle foreign actors.
Delegates to the Fluxion
instance’s internal get function, specifying the actor
that owns the context as the owner of the returned handle.
See System::get
for more info.
source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Removes an actor from the system, and waits for it to stop execution
Delegated directly to System::remove
, implemented on Fluxion
.
See System::remove
for more info.