diff options
Diffstat (limited to 'third_party/rust/termion/examples/alternate_screen.rs')
-rw-r--r-- | third_party/rust/termion/examples/alternate_screen.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/third_party/rust/termion/examples/alternate_screen.rs b/third_party/rust/termion/examples/alternate_screen.rs new file mode 100644 index 0000000000..91d28b1702 --- /dev/null +++ b/third_party/rust/termion/examples/alternate_screen.rs @@ -0,0 +1,17 @@ +extern crate termion; + +use termion::screen::*; +use std::io::{Write, stdout}; +use std::{time, thread}; + +fn main() { + { + let mut screen = AlternateScreen::from(stdout()); + write!(screen, "Welcome to the alternate screen.\n\nPlease wait patiently until we arrive back at the main screen in a about three seconds.").unwrap(); + screen.flush().unwrap(); + + thread::sleep(time::Duration::from_secs(3)); + } + + println!("Phew! We are back."); +} |