Enum ergo_fs::PathType [] [src]

pub enum PathType {
    File(PathFile),
    Dir(PathDir),
}

An an enum containing either a file or a directory.

This is used primarily for: - The items returned from PathDir::list - Serializing paths of different types.

Note: symlinks are not supported because they are impossible for canonicalized paths.

Variants

Methods

impl PathType
[src]

[src]

Resolves and returns the PathType of the given path.

If the path exists but is not a file or a directory (i.e. is a symlink), then io::ErrorKind::InvalidInput is returned.

Examples

use path_abs::PathType;

let src = PathType::new("src")?;

[src]

Consume the PathAbs returning the PathType.

[src]

Unwrap the PathType as a PathFile.

Examples

use path_abs::PathType;

let lib = PathType::new("src/lib.rs")?.unwrap_file();

[src]

Unwrap the PathType as a PathDir.

Examples

use path_abs::PathType;

let src = PathType::new("src")?.unwrap_dir();

[src]

Return whether this variant is PathType::Dir.

[src]

Return whether this variant is PathType::File.

[src]

Create a mock file type. For use in tests only.

See the docs for PathAbs::mock

[src]

Create a mock dir type. For use in tests only.

See the docs for PathAbs::mock

Trait Implementations

impl Serialize for PathType
[src]

[src]

impl Ord for PathType
[src]

[src]

impl Hash for PathType
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Clone for PathType
[src]

[src]

impl Eq for PathType
[src]

impl PartialEq<PathType> for PathType
[src]

[src]

[src]

impl Debug for PathType
[src]

[src]

Formats the value using the given formatter.

impl<'de> Deserialize<'de> for PathType
[src]

[src]

impl PartialOrd<PathType> for PathType
[src]

[src]

[src]

[src]

[src]

[src]

impl PathTypeExt for PathType
[src]

[src]

Create a PathType from a walkdir::DirEntry using fewer syscalls. Read more