Raw mode is still line buffered.
Since io::std::Stdout
is line-buffered with LineWriter
see here: https://github.com/rust-lang/rust/blob/master/src/libstd/io/stdio.rs#L342-L347 . Writing through a RawTerminal
which wraps stdout, as shown in the documentation, still results in line buffering.
use termion::raw::IntoRawMode;
use std::io::{Write, stdout};
fn main() {
let mut stdout = stdout().into_raw_mode().unwrap();
for _ in 0..1000 {
write!(stdout, "text\n").unwrap();
}
}
strace -c
will show 1000 write calls as the stream is still line-buffered which contradicts the documentation of RawTerminal
.