Crates.io | which-rs |
lib.rs | which-rs |
version | 0.1.1 |
source | src |
created_at | 2017-09-13 15:28:20.978377 |
updated_at | 2017-09-20 08:58:07.142888 |
description | Check for and locate installed executables from Rust. |
homepage | https://github.com/realityone/which-rs |
repository | |
max_upload_size | |
id | 31604 |
size | 4,942 |
Check for and locate installed executables from Rust.
Just demostrate how which
command works.
Put this crate in your Cargo.toml
.
[dependencies]
which-rs = "*"
extern crate which;
use std::path::{Path, PathBuf};
use std::collections::HashMap;
fn main() {
let ref file = ["python",];
let ref paths = [Path::new("/usr/local/bin"), Path::new("/usr/bin")];
let mut find_path = HashMap::new();
let all_find = which::which(file, paths, true, Some(&mut find_path));
println!("All binary is found: {:?}", all_find);
println!("Located at {:?}", find_path);
}
which-rs is licensed under the MIT License - see the LICENSE file for details