diff options
Diffstat (limited to 'src/event_loop.rs')
-rw-r--r-- | src/event_loop.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/event_loop.rs b/src/event_loop.rs index 44d71f94..a6eed40e 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -11,6 +11,7 @@ use mio::unix::EventedFd; use ansi; use display; +use event; use term::Term; use util::thread; use sync::FairMutex; @@ -52,6 +53,21 @@ pub struct State { parser: ansi::Processor, } +pub struct Notifier(pub ::mio::channel::Sender<Msg>); + +impl event::Notify for Notifier { + fn notify<B>(&mut self, bytes: B) + where B: Into<Cow<'static, [u8]>> + { + let bytes = bytes.into(); + match self.0.send(Msg::Input(bytes)) { + Ok(_) => (), + Err(_) => panic!("expected send event loop msg"), + } + } +} + + impl Default for State { fn default() -> State { State { |