Trait fluxion::system::System

source ·
pub trait System<C: FluxionParams> {
    // Required methods
    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 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 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<'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 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;
}
Expand description

Required Methods§

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,

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 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,

Initializes foreign message support for an actor.

actor_id should be the id of the local actor, while foreign_id should be how foreign actors identify this actor. Only one message type per foreign_id is supported.

Returns

Returns true if the foreign proxy is successfully setup, and false if the foreign_id is already used.

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,

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,

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,

Removes an actor from the system, and waits for it to stop execution

Object Safety§

This trait is not object safe.

Implementors§