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 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.
Trait Implementations
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
impl RefUnwindSafe for SearchPath
impl Send for SearchPath
impl Sync for SearchPath
impl Unpin for SearchPath
impl UnwindSafe for SearchPath
Blanket Implementations
Mutably borrows from an owned value. Read more