Trait std::fs::PathExt [] [src]

pub trait PathExt {
    fn metadata(&self) -> Result<Metadata>;
    fn symlink_metadata(&self) -> Result<Metadata>;
    fn canonicalize(&self) -> Result<PathBuf>;
    fn read_link(&self) -> Result<PathBuf>;
    fn read_dir(&self) -> Result<ReadDir>;
    fn exists(&self) -> bool;
    fn is_file(&self) -> bool;
    fn is_dir(&self) -> bool;
}
Unstable

: the precise set of methods exposed on this trait may change and some methods may be removed

Utility methods for paths.

Required Methods

fn metadata(&self) -> Result<Metadata>

Unstable

: the precise set of methods exposed on this trait may change and some methods may be removed

Gets information on the file, directory, etc at this path.

Consult the fs::metadata`fs::metadata` documentation for more info.

This call preserves identical runtime/error semantics with fs::metadata`fs::metadata`.

Unstable

: the precise set of methods exposed on this trait may change and some methods may be removed

Gets information on the file, directory, etc at this path.

Consult the fs::symlink_metadata`fs::symlink_metadata` documentation for more info.

This call preserves identical runtime/error semantics with fs::symlink_metadata`fs::symlink_metadata`.

fn canonicalize(&self) -> Result<PathBuf>

Unstable

: the precise set of methods exposed on this trait may change and some methods may be removed

Returns the canonical form of a path, normalizing all components and eliminate all symlinks.

This call preserves identical runtime/error semantics with fs::canonicalize`fs::canonicalize`.

Unstable

: the precise set of methods exposed on this trait may change and some methods may be removed

Reads the symlink at this path.

For more information see fs::read_link`fs::read_link`.

fn read_dir(&self) -> Result<ReadDir>

Unstable

: the precise set of methods exposed on this trait may change and some methods may be removed

Reads the directory at this path.

For more information see fs::read_dir`fs::read_dir`.

fn exists(&self) -> bool

Unstable

: the precise set of methods exposed on this trait may change and some methods may be removed

Boolean value indicator whether the underlying file exists on the local filesystem. Returns false in exactly the cases where fs::stat`fs::stat` fails.

fn is_file(&self) -> bool

Unstable

: the precise set of methods exposed on this trait may change and some methods may be removed

Whether the underlying implementation (be it a file path, or something else) points at a "regular file" on the FS. Will return false for paths to non-existent locations or directories or other non-regular files (named pipes, etc). Follows links when making this determination.

fn is_dir(&self) -> bool

Unstable

: the precise set of methods exposed on this trait may change and some methods may be removed

Whether the underlying implementation (be it a file path, or something else) is pointing at a directory in the underlying FS. Will return false for paths to non-existent locations or if the item is not a directory (eg files, named pipes, etc). Follows links when making this determination.

Implementors