[−][src]Trait path_abs::PathInfo
Methods that return information about a path.
This trait provides the familiar methods from std::path::Path
for the Path*
types. These methods take the same parameters and return
the same types as the originals in the standard library, except where
noted.
As a general rule, methods that can return an error will return a rich
path_abs::Error
instead of a std::io::Error
(although it will
automatically convert into a std::io::Error
with ?
if needed).
Required methods
fn as_path(&self) -> &Path
fn to_arc_pathbuf(&self) -> Arc<PathBuf>
Provided methods
fn as_os_str(&self) -> &OsStr
fn to_str(&self) -> Option<&str>
fn to_string_lossy(&self) -> Cow<str>
fn is_absolute(&self) -> bool
fn is_relative(&self) -> bool
fn has_root(&self) -> bool
fn ancestors(&self) -> Ancestors
fn file_name(&self) -> Option<&OsStr>
fn strip_prefix<P>(&self, base: P) -> Result<&Path, StripPrefixError> where
P: AsRef<Path>,
P: AsRef<Path>,
fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool
fn ends_with<P: AsRef<Path>>(&self, base: P) -> bool
fn file_stem(&self) -> Option<&OsStr>
fn extension(&self) -> Option<&OsStr>
fn components(&self) -> Components
fn iter(&self) -> Iter
fn display(&self) -> Display
fn metadata(&self) -> Result<Metadata>
Queries the file system to get information about a file, directory, etc.
The same as std::path::Path::metadata()
, except that it returns a
rich path_abs::Error
when a problem is encountered.
fn symlink_metadata(&self) -> Result<Metadata>
Queries the metadata about a file without following symlinks.
The same as std::path::Path::symlink_metadata()
, except that it
returns a rich path_abs::Error
when a problem is encountered.
fn exists(&self) -> bool
fn is_file(&self) -> bool
fn is_dir(&self) -> bool
fn read_link(&self) -> Result<PathBuf>
Reads a symbolic link, returning the path that the link points to.
The same as std::path::Path::read_link()
, except that it returns a
rich path_abs::Error
when a problem is encountered.
[`std::path::Pathdoc.rust-lang.org/stable/std/path/struct.Path.html#method.read_link
fn canonicalize(&self) -> Result<PathAbs>
Returns the canonical, absolute form of the path with all intermediate components normalized and symbolic links resolved.
The same as std::path::Path::canonicalize()
,
- On success, returns a
path_abs::PathAbs
instead of aPathBuf
- returns a rich
path_abs::Error
when a problem is encountered
fn parent(&self) -> Result<&Path>
Returns the path without its final component, if there is one.
The same as std::path::Path::parent()
, except that it returns a
Result
with a rich path_abs::Error
when a problem is encountered.