Skip to main content

Timed

Struct 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>

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§

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

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

type Error = <A as Actor>::Error

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

type Message = TimedMessage<M>

The expected type of a message to be received.
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 by tonari-actor for logging/debugging. Default implementation uses type_name().
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) -> Result<(), Self::Error>

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

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

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§

fn addr() -> Addr<Self::Message>

Create address for this actor with default capacities.
Source§

fn addr_with_capacity(capacity: impl Into<Capacity>) -> Addr<Self::Message>

Create address for this actor, specifying its inbox size. Accepts Capacity or usize.
Source§

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

Access wrapped actor.

Source§

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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.