pub trait Actor {
type Error;
fn try_poll(
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<(), Self::Error>>;
}
Expand description
The Actor
trait defines how the actor is run.
Effectively an Actor
is a Future
which returns a Result<(), Error>
,
where Error
is defined on the trait. All Future
s where the Output
type is Result<(), Error>
or ()
implement the Actor
trait.
The easiest way to implement this by using an async function, see the actor module documentation.
Panics
Because this is basically a Future
it also shares it’s characteristics,
including it’s unsafety. Please read the Future
documentation when
implementing or using this trait manually.
Required Associated Types
An error the actor can return to its supervisor. This error will be considered terminal for this actor and should not be an error of regular processing of a message.
How to process non-terminal errors that happen during regular processing is up to the actor.
Required Methods
Try to poll this actor.
This is basically the same as calling Future::poll
.
Panics
Just like with Future
s polling after it returned Poll::Ready
may
cause undefined behaviour, including but not limited to panicking.