Struct linux_info::storage::FsStat
source · pub struct FsStat { /* private fields */ }Expand description
Filesystem statistics
Implementations§
source§impl FsStat
impl FsStat
sourcepub fn read(path: impl AsRef<Path>) -> Result<Self>
pub fn read(path: impl AsRef<Path>) -> Result<Self>
Reads filesystems staticstics for a given file descriptor.
sourcepub fn has_blocks(&self) -> bool
pub fn has_blocks(&self) -> bool
Returns true if the total blocks is bigger than zero.
Examples found in repository?
examples/df_h.rs (line 20)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
fn print_point(point: MountPoint) -> Option<()> {
let stat = point.stats().ok()?;
if !stat.has_blocks() {
return None
}
println!(
"{:<15} {:>10} {:>10} {:>10} {}",
point.mount_source()?,
format!("{:.1}", stat.total()?),
format!("{:.1}", stat.available()?),
format!("{:.1}", stat.used()?),
point.mount_point()?
);
Some(())
}sourcepub fn block_size(&self) -> Option<usize>
pub fn block_size(&self) -> Option<usize>
The block size in bytes used for this filesystem.
sourcepub fn total_blocks(&self) -> Option<usize>
pub fn total_blocks(&self) -> Option<usize>
The total block count.
sourcepub fn free_blocks(&self) -> Option<usize>
pub fn free_blocks(&self) -> Option<usize>
The blocks that are still free may not all be accessible to unprivileged users.
sourcepub fn available_blocks(&self) -> Option<usize>
pub fn available_blocks(&self) -> Option<usize>
The blocks that are free and accessible to unprivileged users.
sourcepub fn used_blocks(&self) -> Option<usize>
pub fn used_blocks(&self) -> Option<usize>
The blocks that are already used.
sourcepub fn total(&self) -> Option<DataSize>
pub fn total(&self) -> Option<DataSize>
The size of the filesystem.
Examples found in repository?
examples/df_h.rs (line 27)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
fn print_point(point: MountPoint) -> Option<()> {
let stat = point.stats().ok()?;
if !stat.has_blocks() {
return None
}
println!(
"{:<15} {:>10} {:>10} {:>10} {}",
point.mount_source()?,
format!("{:.1}", stat.total()?),
format!("{:.1}", stat.available()?),
format!("{:.1}", stat.used()?),
point.mount_point()?
);
Some(())
}sourcepub fn available(&self) -> Option<DataSize>
pub fn available(&self) -> Option<DataSize>
The size of the available space to unprivileged users.
Examples found in repository?
examples/df_h.rs (line 28)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
fn print_point(point: MountPoint) -> Option<()> {
let stat = point.stats().ok()?;
if !stat.has_blocks() {
return None
}
println!(
"{:<15} {:>10} {:>10} {:>10} {}",
point.mount_source()?,
format!("{:.1}", stat.total()?),
format!("{:.1}", stat.available()?),
format!("{:.1}", stat.used()?),
point.mount_point()?
);
Some(())
}sourcepub fn used(&self) -> Option<DataSize>
pub fn used(&self) -> Option<DataSize>
The size of the space that is currently used.
Examples found in repository?
examples/df_h.rs (line 29)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
fn print_point(point: MountPoint) -> Option<()> {
let stat = point.stats().ok()?;
if !stat.has_blocks() {
return None
}
println!(
"{:<15} {:>10} {:>10} {:>10} {}",
point.mount_source()?,
format!("{:.1}", stat.total()?),
format!("{:.1}", stat.available()?),
format!("{:.1}", stat.used()?),
point.mount_point()?
);
Some(())
}