mirror of
https://github.com/openharmony/third_party_rust_which-rs.git
synced 2026-07-01 21:14:07 -04:00
cf6b67581fd446fcd27d3b925023b487392396e8
Issue: https://gitee.com/xxlight/third_party_rust_which-rs/issues/I7169Y Signed-off-by: xxlight <xiaoxiaoliang2@huawei.com> Change-Id: I7e817a9f1f7b125cda2b704437ba4d680ce21552
which
A Rust equivalent of Unix command "which". Locate installed executable in cross platforms.
Support platforms
- Linux
- Windows
- macOS
Examples
-
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
regexfeature, 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()));
Documentation
The documentation is available online.
Description
提供查找可执行文件或库的路径的支持,可以在程序中查找指定可执行文件或库的路径。 | A Rust library that provides support for finding the path to an executable in the system's PATH.
Languages
Rust
100%