commit | 0d6835b6b2e7d421436ae773a5b789e23bb20897 | [log] [tgz] |
---|---|---|
author | Matthew Maurer <mmaurer@google.com> | Thu Mar 09 19:08:21 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Mar 09 19:08:21 2023 +0000 |
tree | bb7fed649d07e5b24e581d19ccf3c547b2b86c62 | |
parent | 083ef712a489a39a3f50c31e65413b3322cbaef2 [diff] | |
parent | 878f532dd57bdcbce44364b7eecb1811140e99b7 [diff] |
Make which available to product and vendor am: 6e9a8c8b4a am: 63c340b3e5 am: f8c7b779bc am: 62884e502a am: 878f532dd5 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/which/+/2476374 Change-Id: Ia6046f0c9cae0490d06c14363e26e17ce46058a5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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.