4 releases

0.2.2 Jan 3, 2019
0.2.1 Nov 8, 2018
0.2.0 Nov 8, 2018
0.1.0 Nov 2, 2018

#82 in Filesystem

Download history 15/week @ 2018-11-24 10/week @ 2018-12-01 11/week @ 2018-12-08 11/week @ 2018-12-15 34/week @ 2018-12-22 25/week @ 2018-12-29 13/week @ 2019-01-05 15/week @ 2019-01-12 19/week @ 2019-01-19 4/week @ 2019-01-26 1/week @ 2019-02-02 7/week @ 2019-02-16 5/week @ 2019-02-23 12/week @ 2019-03-02

51 downloads per month
Used in 2 crates (1 directly)

MIT license

8KB
168 lines

os-detect

Rust crate for detecting the existence of an OS from an unmounted device, or path.

extern crate os_detect;

use os_detect::detect_os_from_device;
use std::path::Path;

pub fn main() {
    let device_path = &Path::new("/dev/sda3");
    let fs = "ext4";
    if let Some(os) = detect_os_from_device(device_path, fs) {
        println!("{:#?}", os);
    }
}

lib.rs:

Provides the means for for detecting the existence of an OS from an unmounted device, or path.

extern crate os_detect;

use os_detect::detect_os_from_device;
use std::path::Path;

pub fn main() {
    let device_path = &Path::new("/dev/sda3");
    let fs = "ext4";
    if let Some(os) = detect_os_from_device(device_path, fs) {
        println!("{:#?}", os);
    }
}

Dependencies

~2MB
~34K SLoC