Struct fluxion::Fluxion

source ·
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>

source

pub fn new(id: &str) -> Self

Creates a new Fluxion instance

source

pub fn outbound_foreign(&self) -> Channel<ForeignMessage>

Gets the outbound foreign channel

source

pub fn get_id(&self) -> &str

Gets the system’s id

Returns

Returns the local system’s id.

source

pub async fn shutdown(&self) -> usize

Shutdown and remove all local actors.

Returns

Returns the number of actors shutdown

source

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>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

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,

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,

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

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. Read more

Auto Trait Implementations§

§

impl<C> !RefUnwindSafe for Fluxion<C>

§

impl<C> Send for Fluxion<C>

§

impl<C> Sync for Fluxion<C>

§

impl<C> Unpin for Fluxion<C>where C: Unpin,

§

impl<C> !UnwindSafe for Fluxion<C>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.