commit | 80ae887cdbcd07315d133af0f1556a5de4a4dffe | [log] [tgz] |
---|---|---|
author | James Farrell <[email protected]> | Fri Sep 20 17:29:12 2024 +0000 |
committer | Automerger Merge Worker <[email protected]> | Fri Sep 20 17:29:12 2024 +0000 |
tree | de627b142f5175c11ec2c6d07263e2070dab5e11 | |
parent | 2b4e29ff937081f2fcf0c8f85582c91b34649fa7 [diff] | |
parent | 47344d244c84b092dfae905fe5edbaf0b08864bc [diff] |
Migrate 26 crates to monorepo am: 186abdd35f am: 47344d244c Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/which/+/3272315 Change-Id: If92bad8f6d333eb31858edf9eed5570329ef85f1 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.