pub struct Path { /* private fields */ }
Expand description
A slice of a path (akin to str
).
More details about the overall approach can be found in the module documentation.
Implementations§
Source§impl Path
impl Path
Sourcepub fn new<'a, P: AsRef<FsStr> + 'a>(path: P) -> &'a Self
pub fn new<'a, P: AsRef<FsStr> + 'a>(path: P) -> &'a Self
Directly wraps a string slice as a Path
slice.
This is a cost-free conversion.
§Examples
use vexide::path::Path;
Path::new("foo.txt");
You can create Path
s from String
s, or even other Path
s:
use alloc::string::String;
use vexide::path::Path;
let string = String::from("foo.txt");
let from_string = Path::new(&string);
let from_path = Path::new(&from_string);
assert_eq!(from_string, from_path);