#linux #proc #mounts #swaps

proc-mounts

Fetch active mounts and swaps on a Linux system

9 releases

0.3.0 Mar 21, 2022
0.2.4 Apr 9, 2020
0.2.3 Nov 8, 2019
0.2.2 Feb 20, 2019
0.1.0 Nov 2, 2018

#189 in Unix APIs

Download history 3735/week @ 2023-11-02 4410/week @ 2023-11-09 4848/week @ 2023-11-16 4143/week @ 2023-11-23 4640/week @ 2023-11-30 6116/week @ 2023-12-07 6513/week @ 2023-12-14 3348/week @ 2023-12-21 3282/week @ 2023-12-28 5153/week @ 2024-01-04 5685/week @ 2024-01-11 5084/week @ 2024-01-18 5401/week @ 2024-01-25 4022/week @ 2024-02-01 5929/week @ 2024-02-08 4394/week @ 2024-02-15

20,611 downloads per month
Used in 26 crates (14 directly)

MIT license

24KB
531 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

~330–790KB
~18K SLoC