1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "macos")]
mod macos;
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "linux")]
use linux as sys;
#[cfg(target_os = "macos")]
use macos as sys;
#[cfg(target_os = "windows")]
use windows as sys;
#[derive(Debug, Clone)]
pub struct MountInfo {
pub path: String,
pub avail: Option<u64>,
pub free: Option<u64>,
pub size: Option<u64>,
pub name: Option<String>,
pub format: Option<String>,
pub readonly: Option<bool>,
pub dummy: bool,
__priv: (),
}
pub use sys::{mountinfos, mountpaths, Error};
impl std::error::Error for Error {}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn mountpaths_works() {
for mountpath in mountpaths().unwrap() {
eprintln!("{}", mountpath);
}
}
#[test]
fn mountinfosworks() {
for mountinfo in mountinfos().unwrap() {
eprintln!("{:?}", mountinfo);
}
}
}