Struct rotor::EarlyScope [] [src]

pub struct EarlyScope<'a> {
    // some fields omitted
}

This is a structure that works similarly to Scope, but doesn't have a context

The primary (and probably the only) use case for the EarlyScope is to allow to create a state machine before context has been intialized. This is useful if you want to put a Notifier of the FSM to a context itself.

Methods

impl<'a> EarlyScope<'a>

fn register(&mut self, io: &Evented, interest: EventSet, opt: PollOpt) -> Result<()>

fn reregister(&mut self, io: &Evented, interest: EventSet, opt: PollOpt) -> Result<()>

fn deregister(&mut self, io: &Evented) -> Result<()>

fn timeout_ms(&mut self, delay: u64) -> Result<Timeout, TimerError>

Add timeout

This method is deprecated use return value of your state machine's action to set a timeout

fn clear_timeout(&mut self, token: Timeout) -> bool

Clear timeout

This method is deprecated (with timeout_ms) use return value of your state machine's action to change a timeout

fn notifier(&mut self) -> Notifier

Create a Notifier that may be used to wakeup enclosed state machine

fn now(&self) -> Time

Time of the current loop iteration

This is a time that needs to be used for timeouts. It's cheap to use

fn estimate_timespec(&self, time: Time) -> Timespec

Returns the Timespec that corresponds to the Time in this loop

Note: this is an estimate, because we use monotonic time under the hood, but Timespec is a subject for adjustments of the system clock.

I.e. it is fine to use this time to present it to the user, but it's wrong to rely on it in code.

Trait Implementations

impl<'a> GenericScope for EarlyScope<'a>

fn register(&mut self, io: &Evented, interest: EventSet, opt: PollOpt) -> Result<()>

fn reregister(&mut self, io: &Evented, interest: EventSet, opt: PollOpt) -> Result<()>

fn deregister(&mut self, io: &Evented) -> Result<()>

fn timeout_ms(&mut self, delay: u64) -> Result<Timeout, TimerError>

fn clear_timeout(&mut self, token: Timeout) -> bool

fn notifier(&mut self) -> Notifier

fn now(&self) -> Time

fn estimate_timespec(&self, time: Time) -> Timespec