> module
std::path
path manipulation
std::path works with filesystem paths as strings, using the host's path rules. Most functions only look at the string; is_dir, is_file, exists and absolute look at the filesystem and need the fs feature.
> functions
The canonical absolute form of the path, with symbolic links and ./.. resolved. The path must exist. The error is the shared io::Error (see xur.std.io(7)), such as Err(io::Error::NotFound) if the path does not exist.
The components of the path, such as ["/", "usr", "bin"] for "/usr/bin".
The file name's last extension, without the dot ("gz" for "archive.tar.gz"); None if there is none.
Whether the path exists and is a directory, or a file. Symbolic links are followed.
Whether the path exists and is a directory, or a file. Symbolic links are followed.
Joins the parts with the path separator. A part that is an absolute path replaces everything before it. With no parts it returns "".
The path without its last component; None for a root or empty path. A bare file name has the parent "".
The file name without its last extension ("archive.tar" for "archive.tar.gz").
> examples
use std::path;
use std::io;
fn main() {
let p = path::join("/usr", "local", "bin");
io::println("{}", p);
io::println("parent: {}", path::parent(p).unwrap());
io::println("ext: {}", path::extension("file.tar.gz").unwrap());
}