How to correctly read and write files in Rust 1.x? De facto ways to work with files
Hello, colleagues! I'm new to Rust and trying to figure out reading and writing files. In other languages (e.g., Python), this is done in one line, but here I've encountered a bunch of options: `std::fs::File`, `BufReader`, `read_to_string`, `write_all`... My head is spinning.\n\nI need to solve two simple tasks:\n1. Read an entire text file into a string.\n2. Write a string to a file (create a new one or overwrite an existing one).\n\nI tried this code, but it seems too cumbersome:\n\n```rust\nuse std::fs::File;\nuse std::io::Read;\n\nfn main() {\n let mut file = File::open("data.txt").unwrap();\n let mut contents = String::new();\n file.read_to_string(&mut contents).unwrap();\n println!("{}", contents);\n}\n```\n\nAnd for writing:\n\n```rust\nuse std::fs::File;\nuse std::io::Wri