diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-10-25 11:12:32 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-10-25 11:12:32 -0400 |
commit | ea4e8883574502ff890a94932d7a9d20055aed22 (patch) | |
tree | 6540500f8a79896cc7ce204feb6887f58eb4ad96 /examples/interhack.rs | |
parent | 3881362830012ee6408b6b2b7799a07e8230badf (diff) | |
download | tokio-pty-process-stream-ea4e8883574502ff890a94932d7a9d20055aed22.tar.gz tokio-pty-process-stream-ea4e8883574502ff890a94932d7a9d20055aed22.zip |
simplify example
Diffstat (limited to 'examples/interhack.rs')
-rw-r--r-- | examples/interhack.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/examples/interhack.rs b/examples/interhack.rs index c0c575e..2e753b5 100644 --- a/examples/interhack.rs +++ b/examples/interhack.rs @@ -10,7 +10,6 @@ struct Interhack { process: tokio_pty_process_stream::Process<input::buf::Stdin>, stdin: input::evented_stdin::Stdin, read_buf: [u8; 4096], - raw_screen: Option<crossterm::RawScreen>, } impl Interhack { @@ -23,7 +22,6 @@ impl Interhack { ), stdin: input::evented_stdin::Stdin::new(), read_buf: [0; 4096], - raw_screen: None, } } @@ -71,7 +69,7 @@ impl Interhack { &'a mut Self, ) -> component_future::Poll<(), ()>] = - &[&Self::poll_input, &Self::poll_process, &Self::poll_screen]; + &[&Self::poll_input, &Self::poll_process]; fn poll_input(&mut self) -> component_future::Poll<(), ()> { let n = component_future::try_ready!(self @@ -101,16 +99,6 @@ impl Interhack { } Ok(component_future::Async::DidWork) } - - fn poll_screen(&mut self) -> component_future::Poll<(), ()> { - if self.raw_screen.is_none() { - self.raw_screen = - Some(crossterm::RawScreen::into_raw_mode().unwrap()); - Ok(component_future::Async::DidWork) - } else { - Ok(component_future::Async::NothingToDo) - } - } } impl futures::future::Future for Interhack { @@ -123,5 +111,6 @@ impl futures::future::Future for Interhack { } fn main() { + let _raw_screen = crossterm::RawScreen::into_raw_mode().unwrap(); tokio::run(futures::future::lazy(Interhack::new)); } |