find

Function find 

Source
pub fn find(exec: &str) -> Option<Utf8PathBuf>
Expand description

find return a PathBuf for the given executable, it tries to find it in PATH and environment variables.

The current implementation checks three places for an executable to use:

  1. $PATH/<executable_name> example: for cargo, this tries all paths in $PATH with appended cargo, returning the first that exists
  2. Appropriate environment variable (erroring if this is set but not a usable executable) example: for cargo, this checks $CARGO environment variable; for rustc, $RUSTC; etc