pub struct Fluxion<C: FluxionParams> { /* private fields */ }
Expand description
Fluxion
The core management functionality of fluxion. Handles the creation, shutdown, and management of actors.
Used Arc
internally, so this can be cloned around, although it is not recommended.
Immutable references can be used to do most things instead.
Implementations§
source§impl<C: FluxionParams> Fluxion<C>
impl<C: FluxionParams> Fluxion<C>
sourcepub fn outbound_foreign(&self) -> Channel<ForeignMessage>
pub fn outbound_foreign(&self) -> Channel<ForeignMessage>
Gets the outbound foreign channel
sourcepub async fn relay_foreign(
&self,
message: ForeignMessage
) -> Result<(), ForeignError>
pub async fn relay_foreign( &self, message: ForeignMessage ) -> Result<(), ForeignError>
Relays a foreign message to an actor on this system.
Upon error, the caller should respond to the message with None
,
unless there is a possibility of recovery.
Errors
Returns an error if the foreign message failed to relay to this system.
Trait Implementations§
source§impl<C: FluxionParams> Clone for Fluxion<C>
impl<C: FluxionParams> Clone for Fluxion<C>
source§impl<C: FluxionParams> System<C> for Fluxion<C>
impl<C: FluxionParams> System<C> for Fluxion<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
Returns
Returns None
if the actor was not added to the system.
If the actor was added to the system, returns Some
containing the actor’s LocalHandle
.
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.
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.
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