use std::fs::File; use std::io::Write; fn main() -> std::io::Result<()> { let mut file = File::create("example.txt")?; file.write_all(b"Hello, Rust!")?; println!("Data written to file!"); Ok(()) }