pub fn read_mounts() -> Result<Vec<Mount>> {
    let labels = read_labels().ok();
    // we'll find the disk for a filesystem by taking the longest
    // disk whose name starts the one of our partition
    // hence the sorting.
    let bd_list = BlockDeviceList::read()?;
    read_mountinfo()?
        .drain(..)
        .map(|info| {
            let top_bd = bd_list.find_top(
                info.dev,
                info.dm_name(),
                info.fs_name(),
            );
            let fs_label = labels.as_ref()
                .and_then(|labels| {
                    labels
                        .iter()
                        .find(|label| label.fs_name == info.fs)
                        .map(|label| label.label.clone())
                });
            let disk = top_bd.map(|bd| Disk::new(bd.name.clone()));
            let stats = Stats::from(&info.mount_point)?;
            Ok(Mount { info, fs_label, disk, stats })
        })
        .collect()
}
/// read all the mount points and load basic information on them
read all the mount points and load basic information on them
read all the mount points and load basic information on them
pub fn read_mounts() -> Result<Vec<Mount>> {
    let labels = read_labels().ok();
    // we'll find the disk for a filesystem by taking the longest
    // disk whose name starts the one of our partition
    // hence the sorting.
    let bd_list = BlockDeviceList::read()?;
    read_mountinfo()?
        .drain(..)
        .map(|info| {
            let top_bd = bd_list.find_top(
                info.dev,
                info.dm_name(),
                info.fs_name(),
            );
            let fs_label = labels.as_ref()
                .and_then(|labels| {
                    labels
                        .iter()
                        .find(|label| label.fs_name == info.fs)
                        .map(|label| label.label.clone())
                });
            let disk = top_bd.map(|bd| Disk::new(bd.name.clone()));
            let stats = Stats::from(&info.mount_point)?;
            Ok(Mount { info, fs_label, disk, stats })
        })
        .collect()
}
pub fn read_mounts ( ) -> Result < Vec < Mount > > { let labels = read_labels ( ) . ok ( ) ; // we'll find the disk for a filesystem by taking the longest // disk whose name starts the one of our partition // hence the sorting. let bd_list = BlockDeviceList :: read ( ) ? ; read_mountinfo ( ) ? . drain ( .. ) . map ( | info | { let top_bd = bd_list . find_top ( info . dev , info . dm_name ( ) , info . fs_name ( ) , ) ; let fs_label = labels . as_ref ( ) . and_then ( | labels | { labels . iter ( ) . find ( | label | label . fs_name == info . fs ) . map ( | label | label . label . clone ( ) ) } ) ; let disk = top_bd . map ( | bd | Disk :: new ( bd . name . clone ( ) ) ) ; let stats = Stats :: from ( & info . mount_point ) ? ; Ok ( Mount { info , fs_label , disk , stats } ) } ) . collect ( ) }
read all the mount points and load basic information on them
read all the mount points and load basic information on them