Trait rs::event_loop::ActorState
source · [−]pub trait ActorState: Clone {
type Event: Event;
type Outcome: Outcome;
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
fn apply_event(self, e: Self::Event, time: Instant) -> Self
fn apply_event(self, e: Self::Event, time: Instant) -> Self
Returns the new internal state after the event gets processed.
fn get_outcome(&self, time: Instant) -> Self::Outcome
fn get_outcome(&self, time: Instant) -> Self::Outcome
Returns the observable state of the actor given this internal state.
fn get_next_wake(&self, now: Instant) -> Option<Instant>
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.