pub struct Fluxion<D> { /* private fields */ }Implementations§
Source§impl<D: Delegate> Fluxion<D>
impl<D: Delegate> Fluxion<D>
Sourcepub fn new(id: &str, delegate: D) -> Self
pub fn new(id: &str, delegate: D) -> Self
§Fluxion::new
Creates a new Fluxion instance with the given system id and delegate
Sourcepub fn get_delegate(&self) -> &D
pub fn get_delegate(&self) -> &D
§Fluxion::get_delegate
Gets a reference to the delegate.
Sourcepub fn get_id(&self) -> &str
pub fn get_id(&self) -> &str
§Fluxion::get_id
Gets the system’s id
Sourcepub async fn get_actor_id(&self, name: &str) -> Option<u64>
pub async fn get_actor_id(&self, name: &str) -> Option<u64>
§Fluxion::get_actor_id
Retrieve’s an actor’s ID by its name
Sourcepub async fn add_named<A: Actor>(
&self,
name: &str,
actor: A,
) -> Result<u64, A::Error>
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.
§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.
Sourcepub async fn add<A: Actor>(&self, actor: A) -> Result<u64, A::Error>
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.
§Errors
Returns an error if the actor failed to initialize. On an error, the actor will not be spawned.
Sourcepub async fn kill<A: Actor>(&self, id: u64)
pub async fn kill<A: Actor>(&self, id: u64)
§Fluxion::kill
Given an actor’s id, kills the actor
Sourcepub async fn get_local<A: Actor>(&self, id: u64) -> Option<LocalRef<A, D>>
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.
Sourcepub async fn get<'a, A: Handler<M>, M: IndeterminateMessage>(
&self,
id: impl Into<Identifier<'a>>,
) -> Option<Arc<dyn MessageSender<M>>>
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.
Sourcepub async fn shutdown(&self)
pub async fn shutdown(&self)
§Fluxion::shutdown
Removes all actors from the system and deallocates the underlying slab.