Fluxion

Struct Fluxion 

Source
pub struct Fluxion<D> { /* private fields */ }
Expand description

§Fluxion

Contains the core actor management functionality of fluxion

Implementations§

Source§

impl<D: Delegate> Fluxion<D>

Source

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

§Fluxion::new

Creates a new Fluxion instance with the given system id and delegate

Source

pub fn get_delegate(&self) -> &D

§Fluxion::get_delegate

Gets a reference to the delegate.

Source

pub fn get_id(&self) -> &str

§Fluxion::get_id

Gets the system’s id

Source

pub async fn get_actor_id(&self, name: &str) -> Option<u64>

§Fluxion::get_actor_id

Retrieve’s an actor’s ID by its name

Source

pub async fn add_named<A: Actor>( &self, name: &str, actor: A, ) -> Result<u64, A::Error>

§Fluxion::add_named

Adds an actor to the local instance, returning its id and assigning the given name to it for retrieval by Fluxion::get_actor_id. This is handy when using actors with static names on a foreign system.

Locks the underlying RwLock as write. This will block "management" functionalities such as adding, removing, and retrieving actors, but will not block any messages.
If an actor with a duplicate name is added, it will overwrite the original actor's name. The original actor won't be killed, but it may become inaccessible.
§Errors

Returns an error if the actor failed to initialize. On an error, the actor will not be spawned, and the name will not be assigned.

Source

pub async fn add<A: Actor>(&self, actor: A) -> Result<u64, A::Error>

§Fluxion::add

Adds an actor to the local instance, returning its id.

Locks the underlying RwLock as write. This will block "management" functionalities such as adding, removing, and retrieving actors, but will not block any messages.
§Errors

Returns an error if the actor failed to initialize. On an error, the actor will not be spawned.

Source

pub async fn kill<A: Actor>(&self, id: u64)

§Fluxion::kill

Given an actor’s id, kills the actor

Locks the underlying RwLock as write. This will block "management" functionalities such as adding, removing, and retrieving actors, but will not block any messages.
Source

pub async fn get_local<A: Actor>(&self, id: u64) -> Option<LocalRef<A, D>>

§Fluxion::get_local

Gets an actor that is known to reside on the local system. This allows messages that are not serializable to still be used even if Fluxion is compiled with foreign message support. This function also allows retrieving an actor handle that is capable of sending multiple different messages.

Source

pub async fn get<'a, A: Handler<M>, M: IndeterminateMessage>( &self, id: impl Into<Identifier<'a>>, ) -> Option<Arc<dyn MessageSender<M>>>

§Fluxion::get

Retrieves an actor reference capable of communicating using the given message via the given ID.

Source

pub async fn shutdown(&self)

§Fluxion::shutdown

Removes all actors from the system and deallocates the underlying slab.

Locks the underlying RwLock as write. This will block "management" functionalities such as adding, removing, and retrieving actors, but will not block any messages.

Trait Implementations§

Source§

impl<D> Clone for Fluxion<D>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<D> Freeze for Fluxion<D>

§

impl<D> !RefUnwindSafe for Fluxion<D>

§

impl<D> Send for Fluxion<D>
where D: Sync + Send,

§

impl<D> Sync for Fluxion<D>
where D: Sync + Send,

§

impl<D> Unpin for Fluxion<D>

§

impl<D> !UnwindSafe for Fluxion<D>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.