[][src]Trait riker::actor::ActorProducer

pub trait ActorProducer: Debug + Send + UnwindSafe + RefUnwindSafe {
    type Actor: Actor;
    fn produce(&self) -> Self::Actor;
}

Represents the underlying Actor factory function for creating instances of Actor.

Actors are not created directly. Instead you provide an ActorProducer that allows the ActorSystem to start an actor when actor_of is used, or when an actor fails and a supervisor requests an actor to be restarted.

ActorProducer can hold values required by the actor's factory method parameters.

Associated Types

type Actor: Actor

Loading content...

Required methods

fn produce(&self) -> Self::Actor

Produces an instance of an Actor.

The underlying factory method provided in the original Props::new(f: Fn() -> A + Send) or Props::new(f: Fn(Args) -> A + Send>, args: Args) is called.

Any parameters Args will be cloned and passed to the function.

Panics

If the provided factory method panics the panic will be caught by the system, resulting in an error result returning to actor_of.

Loading content...

Implementations on Foreign Types

impl<A> ActorProducer for Arc<Mutex<Box<dyn ActorProducer<Actor = A>>>> where
    A: Actor + Send + 'static, 
[src]

type Actor = A

impl<A> ActorProducer for Arc<Mutex<dyn ActorProducer<Actor = A>>> where
    A: Actor + Send + 'static, 
[src]

type Actor = A

impl<A> ActorProducer for Box<dyn ActorProducer<Actor = A>> where
    A: Actor + Send + 'static, 
[src]

type Actor = A

Loading content...

Implementors

Loading content...