Struct tonari_actor::System [−][src]
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]
&mut self,
actor: A
) -> SpawnBuilder<'_, A, impl FnOnce() -> A> where
A: Actor + 'static,
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]
A: Actor + 'static,
F: FnOnce() -> A + Send + 'static,
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]
A: Actor + Send + 'static,
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.
fn deref(&self) -> &Self::Target
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,