rs::event_loop

Trait ActorState

Source
pub trait ActorState: Clone {
    type Event: Event;
    type Outcome: Outcome;

    // Required methods
    fn apply_event(self, e: Self::Event, time: Instant) -> Self;
    fn get_outcome(&self, time: Instant) -> Self::Outcome;
    fn get_next_wake(&self, now: Instant) -> Option<Instant>;
}
Expand description

Contains and calculates the intenal state of the actor.

Required Associated Types§

Required Methods§

Source

fn apply_event(self, e: Self::Event, time: Instant) -> Self

Returns the new internal state after the event gets processed.

Source

fn get_outcome(&self, time: Instant) -> Self::Outcome

Returns the observable state of the actor given this internal state.

Source

fn get_next_wake(&self, now: Instant) -> Option<Instant>

Returns the next wake up to schedule if one is needed. This may be called at any time, so should always return the correct value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§