Enum Status

Source
pub enum Status {
    Done,
    Skip,
    Reset,
    Stop,
}
Expand description

Status of the message and potentially the actor as a resulting from processing a message with the actor.

Variants§

§

Done

The message was processed and can be removed from the channel. Note that this doesn’t necessarily mean that anything was done with the message, just that it can be removed. It is up to the actor to decide what, if anything, to do with the message.

§

Skip

The message was skipped and should remain in the channel. Once a message is skipped a skip cursor will be created in the actor’s message channel which will act as the actual head of the channel until an Status::Reset is returned from an actor’s processor. This enables an actor to skip messages while working on a process and then clear the skip cursor and resume normal processing. This functionality is critical for actors that implement a finite state machine.

§

Reset

Marks the message as processed and clears the skip cursor on the channel. A skip cursor is present when a message has been skipped by an actor returning Status::Skip from a call to the actor’s message processor. If no skip cursor is set than this status is semantically the same as Status::Done.

§

Stop

Returned from an actor when the actor wants the system to stop the actor. When this status is returned the actor’s Aid will no longer send any messages and the actor instance itself will be removed from the actors table in the ActorSystem. The user is advised to do any cleanup needed before returning Status::Stop.

Implementations§

Source§

impl Status

Source

pub fn done<T>(state: T) -> (T, Status)

Ergonomic shortcut for writing (state, Status::Done)

Source

pub fn skip<T>(state: T) -> (T, Status)

Ergonomic shortcut for writing (state, Status::Skip)

Source

pub fn reset<T>(state: T) -> (T, Status)

Ergonomic shortcut for writing (state, Status::Reset)

Source

pub fn stop<T>(state: T) -> (T, Status)

Ergonomic shortcut for writing (state, Status::Stop)

Trait Implementations§

Source§

impl Debug for Status

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Status

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Status

Source§

fn eq(&self, other: &Status) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Status

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Status

Source§

impl StructuralPartialEq for Status

Auto Trait Implementations§

§

impl Freeze for Status

§

impl RefUnwindSafe for Status

§

impl Send for Status

§

impl Sync for Status

§

impl Unpin for Status

§

impl UnwindSafe for Status

Blanket Implementations§

Source§

impl<T> ActorMessage for T
where T: 'static + Serialize + DeserializeOwned + Sync + Send + Any + ?Sized,

Source§

fn to_bincode(&self) -> Result<Vec<u8>, Box<dyn Error>>

Gets a bincode serialized version of the message and returns it in a result or an error indicating what went wrong.
Source§

fn from_bincode(data: &Vec<u8>) -> Result<T, Box<dyn Error>>

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

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Erased for T