[][src]Enum herbert::RouterCtl

pub enum RouterCtl {
    Spawn {
        id: String,
        f: Box<ActorFn>,
        resp: Sender<()>,
    },
    Get {
        id: String,
        resp: Sender<Result<Sender<Message>>>,
    },
    Has {
        id: String,
        resp: Sender<bool>,
    },
    StopActor {
        id: String,
        resp: Sender<()>,
    },
    StopActorAsync(String),
    Shutdown,
}

A control message for the router.

These messages are processed directly by the router itself and control aspects of its operation. Notably, the router is responsible for creating actors and their threads and must receive a RouterCtl::Spawn request to do so.

Variants

Spawn

Create a new actor managed by the router.

Fields of Spawn

id: Stringf: Box<ActorFn>resp: Sender<()>
Get

Retrieve the request channel for an actor from the router.

Fields of Get

id: Stringresp: Sender<Result<Sender<Message>>>
Has

Determine whether or not the router has an actor.

Fields of Has

id: Stringresp: Sender<bool>
StopActor

Stop an actor.

Fields of StopActor

id: Stringresp: Sender<()>
StopActorAsync(String)

Stop an actor without waiting for it to stop.

Shutdown

Stop all actors and then stop the router.

Methods

impl RouterCtl[src]

pub fn spawn(id: &str, f: Box<ActorFn>) -> (Self, Receiver<()>)[src]

Construct a RouterCtl::Spawn request.

Returns the request object as well as a Receiver over which the router will send confirmation back to the requestor that the actor has been spawned.

The spawn_actor! macro provides a more ergonomic wrapper around this method.

pub fn get(id: &str) -> (Self, Receiver<Result<Sender<Message>>>)[src]

Construct a RouterCtl::Get request.

Returns the request object as well as a Receiver over which the router will send back to the caller the Sender for the given actor (or None, if no such actor exists).

The get_actor! macro provides a more ergonomic wrapper around this method.

pub fn has(id: &str) -> (Self, Receiver<bool>)[src]

Construct a RouterCtl::Has request.

Returns the request object as well as a Receiver over which the router will send back a boolean to the caller that indicates whether or not the given actor is available at the time of its observation.

The has_actor! macro provides a more ergonomic wrapper around this method.

pub fn stop_actor(id: &str) -> (Self, Receiver<()>)[src]

Construct a RouterCtl::StopActor request.

Returns the request object as well as a Receiver over which the router will send confirmation back to the caller that the actor has stopped.

pub fn stop_actor_async(id: &str) -> Self[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.