> module
std::fs
filesystem access
std::fs reads and writes files. Functions that touch the filesystem return Result with the shared io::Error on failure. Relative paths are relative to the current directory.
> functions
Adds a string to the end of a file, creating it if needed.
Creates a directory and any missing parents. A directory that already exists is not an error.
The names of the entries in a directory (not their full paths), sorted.
Reads a whole file as text. Err(io::Error::InvalidInput) if it isn't valid UTF-8.
Writes a string to a file, creating it or replacing its contents.
> types
A File is an open file. Copies of it share the same file and position.
An open file, shared by every Xur value referring to it.
Creates a file for writing, or empties an existing one.
> errors
Fallible functions return the shared io::Error (see xur.std.io(7)), e.g. Err(io::Error::NotFound).
> examples
use std::fs;
use std::io;
fn main() -> Result<()> {
fs::write("greeting.txt", "hello")?;
let text = fs::read_to_string("greeting.txt")?;
io::println("{}", text);
Ok(())
}