Struct tonari_actor::timed::Timed

source ·
pub struct Timed<A: Actor> { /* private fields */ }
Expand description

A wrapper around actors to add ability to receive delayed and recurring messages. See module documentation for a complete recipe.

Implementations§

source§

impl<M: Send + 'static, A: Actor<Context = TimedContext<M>, Message = M>> Timed<A>

source

pub fn new(inner: A) -> Self

Trait Implementations§

source§

impl<M: Send + 'static, A: Actor<Context = TimedContext<M>, Message = M>> Actor for Timed<A>

§

type Context = Context<<Timed<A> as Actor>::Message>

What kind of context this actor accepts. Usually Context<Self::Message>.
§

type Error = <A as Actor>::Error

The type to return on error in the handle method.
§

type Message = TimedMessage<M>

The expected type of a message to be received.
source§

const DEFAULT_CAPACITY_HIGH: usize = A::DEFAULT_CAPACITY_HIGH

Default capacity of actor’s high-priority inbox unless overridden by .with_capacity().
source§

const DEFAULT_CAPACITY_NORMAL: usize = A::DEFAULT_CAPACITY_NORMAL

Default capacity of actor’s normal-priority inbox unless overridden by .with_capacity().
source§

fn handle( &mut self, context: &mut Self::Context, timed_message: Self::Message ) -> Result<(), Self::Error>

The primary function of this trait, allowing an actor to handle incoming messages of a certain type.
source§

fn name() -> &'static str

The name of the Actor - used only for logging/debugging.
source§

fn priority(message: &Self::Message) -> Priority

Determine priority of a message before it is sent to this actor. Default implementation returns Priority::Normal.
source§

fn started(&mut self, context: &mut Self::Context)

An optional callback when the Actor has been started.
source§

fn stopped(&mut self, context: &mut Self::Context)

An optional callback when the Actor has been stopped.
source§

fn deadline_passed( &mut self, context: &mut Self::Context, _deadline: Instant ) -> Result<(), Self::Error>

An optional callback when a deadline has passed. Read more
source§

impl<A: Actor> Deref for Timed<A>

Access wrapped actor.

§

type Target = A

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<A> Freeze for Timed<A>
where A: Freeze,

§

impl<A> !RefUnwindSafe for Timed<A>

§

impl<A> Send for Timed<A>
where A: Send,

§

impl<A> !Sync for Timed<A>

§

impl<A> Unpin for Timed<A>
where A: Unpin, <A as Actor>::Message: Unpin,

§

impl<A> !UnwindSafe for Timed<A>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.