Struct search_path::SearchPath[][src]

pub struct SearchPath { /* fields omitted */ }
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 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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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

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.