#linux #proc #mounts #swaps

proc-mounts

Fetch active mounts and swaps on a Linux system

6 releases

0.2.2 Feb 20, 2019
0.2.1 Feb 19, 2019
0.1.2 Jan 3, 2019
0.1.1 Dec 3, 2018
0.1.0 Nov 2, 2018

#72 in Unix APIs

Download history 16/week @ 2018-12-20 3/week @ 2018-12-27 30/week @ 2019-01-03 9/week @ 2019-01-10 23/week @ 2019-01-17 2/week @ 2019-01-24 1/week @ 2019-01-31 2/week @ 2019-02-07 22/week @ 2019-02-14 25/week @ 2019-02-21 17/week @ 2019-02-28 2/week @ 2019-03-07 6/week @ 2019-03-14 71/week @ 2019-03-21 19/week @ 2019-03-28

69 downloads per month

MIT license

27KB
622 lines

proc-mounts

Rust crate that provides easy access to data from the /proc/swaps and /proc/mounts files.

extern crate proc_mounts;

use proc_mounts::{MountIter, SwapIter};
use std::io;

fn main() -> io::Result<()> {
    println!("# Active Mounts");
    for mount in MountIter::new()? {
        println!("{:#?}", mount);
    }

    println!("# Active Swaps");
    for swap in SwapIter::new()? {
        println!("{:#?}", swap);
    }

    Ok(())
}

lib.rs:

Provides easy access to data from the /proc/swaps and /proc/mounts files.

extern crate proc_mounts;

use proc_mounts::{MountIter, SwapIter};
use std::io;

fn main() -> io::Result<()> {
    println!("# Active Mounts");
    for mount in MountIter::new()? {
        println!("{:#?}", mount);
    }

    println!("# Active Swaps");
    for swap in SwapIter::new()? {
        println!("{:#?}", swap);
    }

    Ok(())
}

Dependencies

~1MB
~19K SLoC