pub struct ActorSystem { /* private fields */ }Implementations§
Source§impl ActorSystem
impl ActorSystem
pub fn new() -> Self
Sourcepub fn spawn<M: Send + 'static>(
&self,
name: &str,
handler: impl FnMut(M) + 'static,
) -> Actor<M>
pub fn spawn<M: Send + 'static>( &self, name: &str, handler: impl FnMut(M) + 'static, ) -> Actor<M>
Spawn an actor drained inline by the caller (Graph, Rack).
Handler does not need Send — it lives and dies on the caller’s thread.
Sourcepub fn spawn_detached<M: Send + 'static>(
&self,
name: &str,
make_handler: impl FnOnce() -> Box<dyn FnMut(M) + 'static> + Send + 'static,
interval_ms: u64,
) -> ActorRef<M>
pub fn spawn_detached<M: Send + 'static>( &self, name: &str, make_handler: impl FnOnce() -> Box<dyn FnMut(M) + 'static> + Send + 'static, interval_ms: u64, ) -> ActorRef<M>
Spawn a detached actor — handler is created inside a new OS thread
and drained in a loop. Returns the ActorRef immediately.
make_handler is called inside the spawned thread, so the returned
handler closure does not need Send.
pub fn route<M: Send + 'static>(&self, name: &str, msg: M)
pub fn broadcast<M: Send + Clone + 'static>(&self, msg: M)
pub fn drain_dead(&self) -> Vec<Box<dyn Any + Send>>
pub fn actor_count(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ActorSystem
impl RefUnwindSafe for ActorSystem
impl Send for ActorSystem
impl Sync for ActorSystem
impl Unpin for ActorSystem
impl UnsafeUnpin for ActorSystem
impl UnwindSafe for ActorSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more