commit | 1dad8458645b33e348339cab0786b5c3e0c3c164 | [log] [tgz] |
---|---|---|
author | Matthew Maurer <[email protected]> | Thu Mar 09 18:06:48 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Mar 09 18:06:48 2023 +0000 |
tree | bb7fed649d07e5b24e581d19ccf3c547b2b86c62 | |
parent | bcfaaa4c96f1ceb112b118a9b89a06b6d7597305 [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: Id78ca273c5cfc2828f3767c7e58ae675a85a4daf 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.