pub struct SearchPath { /* private fields */ }
Expand description

This is the search path itself, it wraps a list of file paths which can then be used to find file system entries. See the module description for an overview.

Implementations

Construct a new search path by parsing the environment variable named env_var into separate paths. Paths are separated by the ';' character on Windows, and the ':' character on other platforms.

If the environment variable is not present, or could not be read this function returns an error.

use search_path::SearchPath;

let search_path = SearchPath::new("CMD_PATH").expect("No $CMD_PATH present");

Constructors do not check for duplicate paths, to remove duplicates see the dedup) method.

Construct a new search path by parsing the environment variable named PATH.

Construct a new search path by parsing the environment variable named env_var into separate paths. Paths are separated by the ';' character on Windows, and the ':' character on other platforms.

If the environment variable is not present, or could not be read this function returns the default value provided instead. The default value may be any value that has an Into implementation for SearchPath.

use search_path::SearchPath;

let search_path = SearchPath::new_or("CMD_PATH", ".");

Constructors do not check for duplicate paths, to remove duplicates see the dedup) method.

Construct a new search path by parsing the environment variable named env_var into separate paths. Paths are separated by the ';' character on Windows, and the ':' character on other platforms.

If the environment variable is not present, or could not be read this function returns the value of Default::default() implemented for SearchPath instead.

use search_path::SearchPath;

let search_path = SearchPath::new_or_default("CMD_PATH");

Constructors do not check for duplicate paths, to remove duplicates see the dedup) method.

Return the first file system entity, either file or directory, found in the search path, or None.

Return all the file system entities, either file or directory, found in the search path.

Return the first file found in the search path, or None.

Return the first directory found in the search path, or None.

Return the first file found in the search path, or None. This method will only consider file_name if it is not a path, if it has any path components the method will also return None.

Return true if this instance has no paths to search, else false.

Return the current number of paths in the list of paths to search.

Return true if the list of paths to search contains the path value, else false.

Return true if the list of paths to search contains the current directory path, ".", value, else false.

Return an iterator over all the paths in the list of paths to search.

Append the provided path to the list of paths to search. This operation does not check for duplicate paths, to remove duplicates see the dedup) method.

Append the current directory path, ".", to the list of paths to search. This operation does not check for duplicate paths, to remove duplicates see the dedup) method.

Prepend the provided path to the list of paths to search. This operation does not check for duplicate paths, to remove duplicates see the dedup) method.

Prepend the current directory path, ".", to the list of paths to search. This operation does not check for duplicate paths, to remove duplicates see the dedup) method.

Remove the path from the list of paths to search, this has no effect if the path was not in the list.

Ensure that only one copy of a path exists in the list of paths to search. This operation will ensure the ordering of paths remains the same and keep the first duplicate it finds and remove any subsequent ones.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. 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.