1 unstable release

Uses old Rust 2015

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

#12 in #detect

Download history 7/week @ 2022-12-02 20/week @ 2022-12-09 8/week @ 2022-12-16 19/week @ 2022-12-23 7/week @ 2022-12-30 7/week @ 2023-01-06 3/week @ 2023-01-13 19/week @ 2023-01-20 26/week @ 2023-01-27 20/week @ 2023-02-03 22/week @ 2023-02-10 28/week @ 2023-02-17 14/week @ 2023-02-24 15/week @ 2023-03-03 9/week @ 2023-03-10 10/week @ 2023-03-17

51 downloads per month
Used in 2 crates (via disk-types)

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

~1.7–2.3MB
~46K SLoC