Struct which::CanonicalPath[][src]

pub struct CanonicalPath { /* fields omitted */ }
Expand description

An owned, immutable wrapper around a PathBuf containing the canonical path of an executable.

The constructed PathBuf is the result of which or which_in followed by Path::canonicalize, but CanonicalPath has the advantage of being a type distinct from std::path::Path and std::path::PathBuf.

It can be beneficial to use CanonicalPath instead of std::path::Path when you want the type system to enforce the need for a path that exists, points to a binary that is executable, is absolute, has all components normalized, and has all symbolic links resolved

Since CanonicalPath implements Deref for std::path::Path, all methods on &std::path::Path are also available to &CanonicalPath values.

Implementations

Returns the canonical path of an executable binary by name.

This calls which and Path::canonicalize and maps the result into a CanonicalPath.

Returns the canonical paths of an executable binary by name.

This calls which_all and Path::canonicalize and maps the results into CanonicalPaths.

Returns the canonical path of an executable binary by name in the path list paths and using the current working directory cwd to resolve relative paths.

This calls which_in and Path::canonicalize and maps the result into a CanonicalPath.

Returns all of the canonical paths of an executable binary by name in the path list paths and using the current working directory cwd to resolve relative paths.

This calls which_in_all and Path::canonicalize and maps the result into a CanonicalPath.

Returns a reference to a std::path::Path.

Consumes the which::CanonicalPath, yielding its underlying std::path::PathBuf.

Trait Implementations

Performs the conversion.

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

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

This method tests for !=.

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

This method tests for !=.

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.