commit | 878f532dd57bdcbce44364b7eecb1811140e99b7 | [log] [tgz] |
---|---|---|
author | Matthew Maurer <[email protected]> | Thu Mar 09 18:06:20 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Mar 09 18:06:20 2023 +0000 |
tree | bb7fed649d07e5b24e581d19ccf3c547b2b86c62 | |
parent | c72a9258f74a548031f7a433328682def42c240c [diff] | |
parent | 62884e502a4d24cefc135591ef2be0f50e4ed593 [diff] |
Make which available to product and vendor am: 6e9a8c8b4a am: 63c340b3e5 am: f8c7b779bc am: 62884e502a Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/which/+/2476374 Change-Id: Ibfe22675385ea433dd2cea2257d42e7ee1dc3b0c Signed-off-by: Automerger Merge Worker <[email protected]>
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.