lfs_core/stats/
windows.rs

1use crate::Inodes;
2
3/// inode & storage usage information
4#[derive(Debug, Clone)]
5pub struct Stats {
6    /// number of bytes
7    pub size: u64,
8    /// number of free bytes
9    pub free: u64,
10    /// information relative to inodes, if available
11    pub inodes: Option<Inodes>,
12}
13
14impl Stats {
15    pub fn size(&self) -> u64 {
16        self.size
17    }
18    pub fn available(&self) -> u64 {
19        self.free
20    }
21    /// Space used in the volume (including unreadable fs metadata)
22    pub fn used(&self) -> u64 {
23        self.size - self.free
24    }
25    pub fn use_share(&self) -> f64 {
26        if self.free == 0 {
27            0.0
28        } else {
29            (self.size - self.free) as f64 / self.size as f64
30        }
31    }
32}