commit | baeb0a5a42c31c50ac1512975b9e2997586109c4 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Mar 10 04:18:53 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Mar 10 04:18:53 2023 +0000 |
tree | bb7fed649d07e5b24e581d19ccf3c547b2b86c62 | |
parent | 337a6d622b94fd3d4902a35c99c52712ccec8fe3 [diff] | |
parent | 4e57a3a15685909488544099d60f532eb62e0914 [diff] |
Snap for 9719949 from 62884e502a4d24cefc135591ef2be0f50e4ed593 to udc-release am: 4e57a3a156 Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/which/+/21946636 Change-Id: I51b2fc151faccb69809a7390bedc2ec865fba586 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.