Trait kabuki::Actor
[−]
[src]
pub trait Actor { type Request; type Response; type Error; type Future: IntoFuture<Item=Self::Response, Error=Self::Error>; fn call(&mut self, req: Self::Request) -> Self::Future; fn poll(&mut self, state: ActorState) -> Async<()> { ... } fn poll_ready(&mut self) -> Async<()> { ... } }
A value that manages state and responds to messages
Associated Types
type Request
The message sent to the actor
type Response
The response sent back from the actor
type Error
The response error
type Future: IntoFuture<Item=Self::Response, Error=Self::Error>
The internal response future. This will remain on the actor's task and will be polled to completion before being sent back to the caller.
Required Methods
fn call(&mut self, req: Self::Request) -> Self::Future
Process an inbound message and return a response.
The response future will be polled until the value is realized and the response value will be sent back to the sender of the message.
Provided Methods
fn poll(&mut self, state: ActorState) -> Async<()>
Poll the Actor
to see if it has completed processing.
Allows the actor to advance its internal state without receiving a message. For example, if the actor sets a timeout, the task managing the actor will get notified and this function will be called.
fn poll_ready(&mut self) -> Async<()>
Indicates that the actor is ready to process the next inbox message
Before the ActorCell
attempts to read a message off the inbox, it will
call this function. If the actor value is not ready to process a new
message, the cell will wait until it is.
Implementors
impl<F, T, U> Actor for ActorFn<F, T> where F: FnMut(T) -> U, U: IntoFuture