Crate search_path[][src]

Expand description

Provides a very simple search path file finder.

More detailed description, with

Constructors

The SearchPath type also has From<> implementations for PathBuf, Vec<PathBuf>, Vec<&Path>, Vec<&str>, String, and &str.

Example

The following example shows the common pattern of finding an executable command on the command line.

use search_path::SearchPath;
use std::path::PathBuf;

fn which_command(cmd_name: &str) -> Option<PathBuf> {
    let search_path = SearchPath::new("PATH").expect("How do you live with no $PATH?");
    search_path.find_file(&PathBuf::from(cmd_name))
}

Structs

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.