Trait Actor

Source
pub trait Actor: Any {
    // Required methods
    fn id(&self) -> Ustr;
    fn handle(&mut self, msg: &dyn Any);
    fn as_any(&self) -> &dyn Any;

    // Provided method
    fn as_any_mut(&mut self) -> &mut dyn Any
       where Self: Sized { ... }
}

Required Methods§

Source

fn id(&self) -> Ustr

The unique identifier for the actor.

Source

fn handle(&mut self, msg: &dyn Any)

Handles the msg.

Source

fn as_any(&self) -> &dyn Any

Returns a reference to self as Any, for downcasting support.

Provided Methods§

Source

fn as_any_mut(&mut self) -> &mut dyn Any
where Self: Sized,

Returns a mutable reference to self as Any, for downcasting support.

Default implementation simply coerces &mut Self to &mut dyn Any.

§Note

This method is not object-safe and thus only available on sized Self.

Implementors§

Source§

impl Actor for DataActorCore

Source§

impl<T, F> Actor for Throttler<T, F>
where T: 'static, F: Fn(T) + 'static,