aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-07-02 08:32:28 -0700
committerJoe Wilm <joe@jwilm.com>2016-07-02 08:32:28 -0700
commitbc2793a762b505d2d3c7af65e878f864a36cb19b (patch)
treea51d1c5ef9938a3b82ca3802cf1d9982cd77a87b /src/main.rs
parentf2e6d66a5e8ada1bd0c860eaa3d50e100a72f68b (diff)
downloadr-alacritty-bc2793a762b505d2d3c7af65e878f864a36cb19b.tar.gz
r-alacritty-bc2793a762b505d2d3c7af65e878f864a36cb19b.tar.bz2
r-alacritty-bc2793a762b505d2d3c7af65e878f864a36cb19b.zip
Move WriteNotifier type into input module
It's a generic impl of `input::Notify` for `Write` types; as such, it seems completely reasonable to include in the input module. Moving it also serves to declutter main.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs
index 7bf4d7d3..aae02322 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -69,14 +69,6 @@ enum ShouldExit {
Yes,
No
}
-
-struct WriteNotifier<'a, W: Write + 'a>(&'a mut W);
-impl<'a, W: Write> input::Notify for WriteNotifier<'a, W> {
- fn notify(&mut self, message: &str) {
- self.0.write(message.as_bytes()).unwrap();
- }
-}
-
/// Channel used by resize handling on mac
static mut resize_sender: Option<mpsc::Sender<glutin::Event>> = None;
@@ -108,7 +100,7 @@ fn handle_event<W>(event: glutin::Event,
render_tx.send((w, h)).expect("render thread active");
},
glutin::Event::KeyboardInput(state, _code, key) => {
- input_processor.process(state, key, &mut WriteNotifier(writer), *terminal.mode())
+ input_processor.process(state, key, &mut input::WriteNotifier(writer), *terminal.mode())
},
_ => ()
}