Struct devtools::actor::ActorRegistry

source ·
pub struct ActorRegistry {
    actors: HashMap<String, Box<dyn Actor + Send>>,
    new_actors: RefCell<Vec<Box<dyn Actor + Send>>>,
    old_actors: RefCell<Vec<String>>,
    script_actors: RefCell<HashMap<String, String>>,
    shareable: Option<Arc<Mutex<ActorRegistry>>>,
    next: Cell<u32>,
    start_stamp: CrossProcessInstant,
}
Expand description

A list of known, owned actors.

Fields§

§actors: HashMap<String, Box<dyn Actor + Send>>§new_actors: RefCell<Vec<Box<dyn Actor + Send>>>§old_actors: RefCell<Vec<String>>§script_actors: RefCell<HashMap<String, String>>§shareable: Option<Arc<Mutex<ActorRegistry>>>§next: Cell<u32>§start_stamp: CrossProcessInstant

Implementations§

source§

impl ActorRegistry

source

pub fn new() -> ActorRegistry

Create an empty registry.

source

pub(crate) fn cleanup(&self, id: StreamId)

source

pub fn create_shareable(self) -> Arc<Mutex<ActorRegistry>>

Creating shareable registry

source

pub fn shareable(&self) -> Arc<Mutex<ActorRegistry>>

Get shareable registry through threads

source

pub fn start_stamp(&self) -> CrossProcessInstant

Get start stamp when registry was started

source

pub fn register_script_actor(&self, script_id: String, actor: String)

source

pub fn script_to_actor(&self, script_id: String) -> String

source

pub fn script_actor_registered(&self, script_id: String) -> bool

source

pub fn actor_to_script(&self, actor: String) -> String

source

pub fn new_name(&self, prefix: &str) -> String

Create a unique name based on a monotonically increasing suffix

source

pub(crate) fn register(&mut self, actor: Box<dyn Actor + Send>)

Add an actor to the registry of known actors that can receive messages.

source

pub(crate) fn register_later(&self, actor: Box<dyn Actor + Send>)

source

pub fn find<'a, T: Any>(&'a self, name: &str) -> &'a T

Find an actor by registered name

source

pub fn find_mut<'a, T: Any>(&'a mut self, name: &str) -> &'a mut T

Find an actor by registered name

source

pub(crate) fn handle_message( &mut self, msg: &Map<String, Value>, stream: &mut TcpStream, id: StreamId, ) -> Result<(), ()>

Attempt to process a message as directed by its to property. If the actor is not found or does not indicate that it knew how to process the message, ignore the failure.

source

pub fn drop_actor(&mut self, name: String)

source

pub fn drop_actor_later(&self, name: String)

Auto Trait Implementations§

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> 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T