Struct rotor::Handler
[−]
[src]
pub struct Handler<Ctx, M> where M: Machine<Context=Ctx> {
// some fields omitted
}
Standard mio loop handler
Examples
extern crate mio; extern crate rotor; let mut event_loop = mio::EventLoop::new().unwrap(); let mut handler = rotor::Handler::new(Context, &mut event_loop); let conn = handler.add_machine_with(&mut event_loop, |scope| { Ok(StateMachineConstuctor(..)) }); assert!(conn.is_ok()); event_loop.run(&mut handler).unwrap();
Methods
impl<C, M> Handler<C, M> where M: Machine<Context=C>
[src]
fn new_with_capacity(context: C, eloop: &mut EventLoop<Handler<C, M>>, capacity: usize) -> Handler<C, M>
fn new(context: C, eloop: &mut EventLoop<Handler<C, M>>) -> Handler<C, M>
impl<C, M> Handler<C, M> where M: Machine<Context=C>
[src]
fn add_machine_with<F>(&mut self, eloop: &mut EventLoop<Self>, fun: F) -> Result<(), SpawnError<()>> where F: FnOnce(&mut Scope<C>) -> Result<M, Box<Error>>
Trait Implementations
impl<Ctx, M> Handler for Handler<Ctx, M> where M: Machine<Context=Ctx>
[src]
type Message = Notify
type Timeout = Timeo
fn ready<'x>(&mut self, eloop: &'x mut EventLoop<Self>, token: Token, events: EventSet)
Invoked when the socket represented by token
is ready to be operated on. events
indicates the specific operations that are ready to be performed. Read more
fn notify(&mut self, eloop: &mut EventLoop<Self>, msg: Notify)
Invoked when a message has been received via the event loop's channel.
fn timeout(&mut self, eloop: &mut EventLoop<Self>, timeo: Timeo)
Invoked when a timeout has completed.
fn interrupted(&mut self, event_loop: &mut EventLoop<Self>)
Invoked when EventLoop
has been interrupted by a signal interrupt.
fn tick(&mut self, event_loop: &mut EventLoop<Self>)
Invoked at the end of an event loop tick.