Enum path_abs::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 Debug for PathType
[src]

[src]

Formats the value using the given formatter.

impl Clone for PathType
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for PathType
[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 PartialEq for PathType
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl PartialOrd for PathType
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for PathType
[src]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more