From ea4e8883574502ff890a94932d7a9d20055aed22 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 25 Oct 2019 11:12:32 -0400 Subject: simplify example --- examples/interhack.rs | 15 ++------------- 1 file 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, stdin: input::evented_stdin::Stdin, read_buf: [u8; 4096], - raw_screen: Option, } 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)); } -- cgit v1.2.3