Struct rotor::Scope
[−]
[src]
pub struct Scope<'a, C: Sized + 'a> { // some fields omitted }
The structure passed to every action handler
Scope is used for the following purposes:
- Register/deregister sockets in the event loop
- Register timeouts
- Create a special
Notifier
object to wakeup sibling state machines - 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]
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
Create a Notifier
that may be used to wakeup
enclosed state machine
fn shutdown_loop(&mut self)
Shutdown the event loop
Trait Implementations
impl<'a, C: Sized + 'a> GenericScope for Scope<'a, C>
[src]
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
Create a Notifier
that may be used to wakeup
enclosed state machine
impl<'a, C> Deref for Scope<'a, C>
[src]
type Target = C
The resulting type after dereferencing
fn deref(&self) -> &C
The method called to dereference a value
impl<'a, C> DerefMut for Scope<'a, C>
[src]
fn deref_mut(&mut self) -> &mut C
The method called to mutably dereference a value