#which #unix #command #which-rs

which

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

12 releases (stable)

3.1.0 Nov 3, 2019
2.0.1 Nov 27, 2018
2.0.0 Mar 30, 2018
1.0.5 Feb 17, 2018
0.1.0 Oct 6, 2015

#3 in Operating systems

Download history 24956/week @ 2019-07-21 24836/week @ 2019-07-28 26435/week @ 2019-08-04 27136/week @ 2019-08-11 26636/week @ 2019-08-18 26346/week @ 2019-08-25 26538/week @ 2019-09-01 27796/week @ 2019-09-08 29067/week @ 2019-09-15 30934/week @ 2019-09-22 34659/week @ 2019-09-29 35736/week @ 2019-10-06 37713/week @ 2019-10-13 40173/week @ 2019-10-20 40386/week @ 2019-10-27

134,996 downloads per month
Used in 684 crates (41 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

~315KB