aboutsummaryrefslogtreecommitdiffstats
path: root/examples/process_full.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/process_full.rs')
-rw-r--r--examples/process_full.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/process_full.rs b/examples/process_full.rs
index 5aa5422..3be0ec0 100644
--- a/examples/process_full.rs
+++ b/examples/process_full.rs
@@ -1,4 +1,4 @@
-use std::io::{Read as _, Write as _};
+use std::io::Read as _;
fn read_frames() -> impl Iterator<Item = Vec<u8>> {
(1..=7625).map(|i| {
@@ -12,12 +12,15 @@ fn read_frames() -> impl Iterator<Item = Vec<u8>> {
}
fn draw_frames(frames: &[Vec<u8>]) {
- let mut stdout = std::io::stdout();
+ let stdout = std::io::stdout();
+ let mut stdout = stdout.lock();
let mut parser = vt100::Parser::default();
for frame in frames {
parser.process(&frame);
- let contents = parser.screen().contents_formatted();
- stdout.write_all(&contents).unwrap();
+ parser
+ .screen()
+ .write_contents_formatted(&mut stdout)
+ .unwrap();
}
}