Marijn Suijten 441642368a Replace ancient lazy_static crate with once_cell
Piggybacking on the [motivation in winit]: `lazy_static!` is a macro
whereas `once_cell` achieves the same using generics.  Its
implementation has also been [proposed for inclusion in `std`], making
it easier to switch to a standardized version if/when that happens.  The
author of that winit PR is making this change to many more crates,
slowly turning the scales in favour of `once_cell` in most dependency
trees.  Furthermore `lazy_static` hasn't published any updates for 3
years.

See also [the `once_cell` F.A.Q.].

[motivation in winit]: https://github.com/rust-windowing/winit/pull/2313
[proposed for inclusion in `std`]: https://github.com/rust-lang/rust/issues/74465
[the `once_cell` F.A.Q.]: https://docs.rs/once_cell/latest/once_cell/#faq
2022-06-11 19:47:11 +02:00
2022-03-20 20:56:54 +08:00
2015-10-06 19:24:01 +08:00
2021-11-30 22:31:44 +01:00

Build Status

which

A Rust equivalent of Unix command "which". Locate installed executable in cross platforms.

Support platforms

  • Linux
  • Windows
  • macOS

Examples

  1. To find which rustc executable binary is using.

    use which::which;
    
    let result = which("rustc").unwrap();
    assert_eq!(result, PathBuf::from("/usr/bin/rustc"));
    
  1. 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()));
    

Documentation

The documentation is available online.

S
Description
提供查找可执行文件或库的路径的支持,可以在程序中查找指定可执行文件或库的路径。 | A Rust library that provides support for finding the path to an executable in the system's PATH.
Readme 636 KiB
Languages
Rust 100%