Struct tonari_actor::System[][src]

pub struct System { /* fields omitted */ }

Systems are responsible for keeping track of their spawned actors, and managing their lifecycles appropriately.

You may run multiple systems in the same application, each system being responsible for its own pool of actors.

Implementations

impl System[src]

pub fn new(name: &str) -> Self[src]

Creates a new System with a given name.

pub fn with_callbacks(name: &str, callbacks: SystemCallbacks) -> Self[src]

pub fn prepare<A>(
    &mut self,
    actor: A
) -> SpawnBuilder<'_, A, impl FnOnce() -> A> where
    A: Actor + 'static, 
[src]

Prepare an actor to be spawned. Returns a SpawnBuilder which can be used to customize the spawning of the actor.

pub fn prepare_fn<A, F>(&mut self, factory: F) -> SpawnBuilder<'_, A, F> where
    A: Actor + 'static,
    F: FnOnce() -> A + Send + 'static, 
[src]

Similar to prepare, but an actor factory is passed instead of an Actor itself. This is used when an actor needs to be created on its own thread instead of the calling thread. Returns a SpawnBuilder which can be used to customize the spawning of the actor.

pub fn spawn<A>(&mut self, actor: A) -> Result<Addr<A>, ActorError> where
    A: Actor + Send + 'static, 
[src]

Spawn a normal Actor in the system, returning its address when successful.

pub fn run(&mut self) -> Result<(), ActorError>[src]

Block the current thread until the system is shutdown.

Methods from Deref<Target = SystemHandle>

pub fn shutdown(&self) -> Result<(), ActorError>[src]

Stops all actors spawned by this system.

pub fn is_running(&self) -> bool[src]

Trait Implementations

impl Default for System[src]

impl Deref for System[src]

type Target = SystemHandle

The resulting type after dereferencing.

impl Drop for System[src]

Auto Trait Implementations

impl !RefUnwindSafe for System

impl Send for System

impl Sync for System

impl Unpin for System

impl !UnwindSafe for System

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.