#which #unix #command #which-rs

which

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

13 releases (stable)

3.1.1 Mar 7, 2020
3.1.0 Nov 3, 2019
3.0.0 Sep 22, 2019
2.0.1 Nov 27, 2018
0.1.0 Oct 6, 2015

#4 in Operating systems

Download history 41803/week @ 2019-12-17 21403/week @ 2019-12-24 29620/week @ 2019-12-31 47665/week @ 2020-01-07 48945/week @ 2020-01-14 50589/week @ 2020-01-21 50841/week @ 2020-01-28 51789/week @ 2020-02-04 49117/week @ 2020-02-11 52686/week @ 2020-02-18 53810/week @ 2020-02-25 57542/week @ 2020-03-03 65802/week @ 2020-03-10 64280/week @ 2020-03-17 63558/week @ 2020-03-24 55719/week @ 2020-03-31

198,578 downloads per month
Used in 710 crates (57 directly)

MIT license

20KB
448 lines

Travis Build Status Appveyor Build status

which

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

Support platforms

  • Linux
  • Windows
  • macOS

Example

To find which rustc exectable binary is using.

use which::which;

let result = which::which("rustc").unwrap();
assert_eq!(result, PathBuf::from("/usr/bin/rustc"));

Errors

By default this crate exposes a failure based error. This is optional, disable the default features to get an error type implementing the standard library Error trait.

Documentation

The documentation is available online.


lib.rs:

which

A Rust equivalent of Unix command which(1).

Example:

To find which rustc executable binary is using:

use which::which;

let result = which::which("rustc").unwrap();
assert_eq!(result, PathBuf::from("/usr/bin/rustc"));

Dependencies

~320KB