pub fn write_file(path: &str, content: &str) -> Result<(), std::io::Error> {
OpenOptions::new()
.write(true)
.create(true)
.open(path)
.and_then(|mut file| {
file.lock_exclusive().and_then(|()| {
file.write_all(content.as_bytes())
});
Ok(())
})
}
How can I modify this method that it works similarly to fprintf:
write_file("/output.txt", "hello, {}. look {}", name, box);