commit | 63c340b3e5a48d009f15619225fc5cd20e1c26cf | [log] [tgz] |
---|---|---|
author | Matthew Maurer <[email protected]> | Thu Mar 09 15:13:02 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Mar 09 15:13:02 2023 +0000 |
tree | bb7fed649d07e5b24e581d19ccf3c547b2b86c62 | |
parent | 26caf7138b86de0a9aa5fbb388eb1971bed964fb [diff] | |
parent | 6e9a8c8b4a5acda14e6b59a691a49ab4daf91e6d [diff] |
Make which available to product and vendor am: 6e9a8c8b4a Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/which/+/2476374 Change-Id: I6eeab9134f61715766dac3b9489c156825468c1a 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.