use std::fs::File;
use std::io::prelude;
fn main()
{
let mut file = File::create("Testing.txt").expect("Could not run file!");
file.write_all(b"Hello world").expect("something"); // Apparently there is an error
}
I get an error here after running cargo run
error[E0599]: no method named `write_all` found for type `std::fs::File` in the current scope
--> src/main.rs:7:10
|
7 | file.write_all(b"Hello world").expect("something");
| ^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
1 | use std::io::Write;
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
error: Could not compile `learning`.
Additionally I want to know what does file.write_all(b"Hello world") what does the b character mean?