commit | 6e9a8c8b4a5acda14e6b59a691a49ab4daf91e6d | [log] [tgz] |
---|---|---|
author | Matthew Maurer <[email protected]> | Tue Mar 07 17:25:12 2023 -0800 |
committer | Matthew Maurer <[email protected]> | Tue Mar 07 17:25:12 2023 -0800 |
tree | bb7fed649d07e5b24e581d19ccf3c547b2b86c62 | |
parent | a065455574fc17a5ddd2149526dcaf8a13556a07 [diff] |
Make which available to product and vendor Bug: 270690570 Test: mma in external/rust/crates Change-Id: I523a50d8511bd210a11a6c71231e933749575da4
A Rust equivalent of Unix command “which”. Locate installed executable in cross platforms.
To find which rustc executable binary is using.
use which::which; let result = which("rustc").unwrap(); assert_eq!(result, PathBuf::from("/usr/bin/rustc"));
After enabling the regex
feature, find all cargo subcommand executables on the path:
use which::which_re; which_re(Regex::new("^cargo-.*").unwrap()).unwrap() .for_each(|pth| println!("{}", pth.to_string_lossy()));
The documentation is available online.