The below code in theory should work yet it doesn't why?
use std::{
fs::OpenOptions,
io::{Read, Write},
};
fn main() -> std::io::Result<()> {
let mut file = OpenOptions::new()
.read(true)
.write(true)
.truncate(true)
.create(true)
.open("test.txt")?;
file.write_all(b"maybe worky!")?;
file.flush()?;
let mut buf = String::new();
file.read_to_string(&mut buf)?;
println!("test.txt\n{}", buf);
Ok(())
}