planning and flushing

This commit is contained in:
mehbark 2025-03-22 21:03:19 -04:00
parent 6db40138d1
commit 34d47fe749

View file

@ -1,7 +1,7 @@
use std::{
collections::HashMap,
error::Error,
io::{self, Read},
io::{self, Read, Write},
};
use bstr::ByteSlice;
@ -15,7 +15,9 @@ struct Args {
#[arg(short, long)]
count: usize,
// TODO: higher-order chains
// TODO: save chains
}
// long-term TODO: live up to name :P
// use bstr because we don't give a cr*p about utf-8!
fn main() -> Result<(), Box<dyn Error>> {
@ -26,6 +28,8 @@ fn main() -> Result<(), Box<dyn Error>> {
// printing the first word immediately gives an intuitive idea of how long freq construction takes
print!("{first_word} ");
// (we need to manually flush to have the intended effect)
io::stdout().flush()?;
let mut buf = Vec::with_capacity(1 << 16);
io::stdin().read_to_end(&mut buf)?;