Struct rotor::Scope [] [src]

pub struct Scope<'a, C: Sized + 'a> { /* fields omitted */ }

The structure passed to every action handler

Scope is used for the following purposes:

  1. Register/deregister sockets in the event loop
  2. Register timeouts
  3. Create a special Notifier object to wakeup sibling state machines
  4. Access to global state of the loop (Context)

All methods here operate on enclosed state machine, which means the state machine that was called with this scope. Or in other words the state machine that actually performs an action.

The only way to notify another state machine is to create a notifier() (the Notifier is only able to wakeup this state machine still), transfer it to another state machine (for example putting it into the context) and call Notifier::wakeup().

The structure derefs to the context (C) for convenience

Methods

impl<'a, C: Sized + 'a> Scope<'a, C>
[src]

Add timeout

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

Clear timeout

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

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

Shutdown the event loop

Time of the current loop iteration

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

Returns the SystemTime that corresponds to the Time in this loop

Note: this is an estimate, because we use monotonic time under the hood, but SystemTime 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, C: Sized + 'a> GenericScope for Scope<'a, C>
[src]

Add timeout

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

Clear timeout

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

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

Time of the current loop iteration

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

Returns the SystemTime that corresponds to the Time in this loop Read more

impl<'a, C> Deref for Scope<'a, C>
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<'a, C> DerefMut for Scope<'a, C>
[src]

The method called to mutably dereference a value