1 use {Ready, Token};
2 use deprecated::{EventLoop};
3 
4 #[allow(unused_variables)]
5 pub trait Handler: Sized {
6     type Timeout;
7     type Message;
8 
9     /// Invoked when the socket represented by `token` is ready to be operated
10     /// on. `events` indicates the specific operations that are
11     /// ready to be performed.
12     ///
13     /// For example, when a TCP socket is ready to be read from, `events` will
14     /// have `readable` set. When the socket is ready to be written to,
15     /// `events` will have `writable` set.
16     ///
17     /// This function will only be invoked a single time per socket per event
18     /// loop tick.
19     fn ready(&mut self, event_loop: &mut EventLoop<Self>, token: Token, events: Ready) {
20     }
21 
22     /// Invoked when a message has been received via the event loop's channel.
23     fn notify(&mut self, event_loop: &mut EventLoop<Self>, msg: Self::Message) {
24     }
25 
26     /// Invoked when a timeout has completed.
27     fn timeout(&mut self, event_loop: &mut EventLoop<Self>, timeout: Self::Timeout) {
28     }
29 
30     /// Invoked when `EventLoop` has been interrupted by a signal interrupt.
31     fn interrupted(&mut self, event_loop: &mut EventLoop<Self>) {
32     }
33 
34     /// Invoked at the end of an event loop tick.
35     fn tick(&mut self, event_loop: &mut EventLoop<Self>) {
36     }
37 }
38