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)
17fn print_point(point: MountPoint) -> Option<()> {
18 let stat = point.stats().ok()?;
19
20 if !stat.has_blocks() {
21 return None
22 }
23
24 println!(
25 "{:<15} {:>10} {:>10} {:>10} {}",
26 point.mount_source()?,
27 format!("{:.1}", stat.total()?),
28 format!("{:.1}", stat.available()?),
29 format!("{:.1}", stat.used()?),
30 point.mount_point()?
31 );
32
33 Some(())
34}
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)
17fn print_point(point: MountPoint) -> Option<()> {
18 let stat = point.stats().ok()?;
19
20 if !stat.has_blocks() {
21 return None
22 }
23
24 println!(
25 "{:<15} {:>10} {:>10} {:>10} {}",
26 point.mount_source()?,
27 format!("{:.1}", stat.total()?),
28 format!("{:.1}", stat.available()?),
29 format!("{:.1}", stat.used()?),
30 point.mount_point()?
31 );
32
33 Some(())
34}
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)
17fn print_point(point: MountPoint) -> Option<()> {
18 let stat = point.stats().ok()?;
19
20 if !stat.has_blocks() {
21 return None
22 }
23
24 println!(
25 "{:<15} {:>10} {:>10} {:>10} {}",
26 point.mount_source()?,
27 format!("{:.1}", stat.total()?),
28 format!("{:.1}", stat.available()?),
29 format!("{:.1}", stat.used()?),
30 point.mount_point()?
31 );
32
33 Some(())
34}
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)
17fn print_point(point: MountPoint) -> Option<()> {
18 let stat = point.stats().ok()?;
19
20 if !stat.has_blocks() {
21 return None
22 }
23
24 println!(
25 "{:<15} {:>10} {:>10} {:>10} {}",
26 point.mount_source()?,
27 format!("{:.1}", stat.total()?),
28 format!("{:.1}", stat.available()?),
29 format!("{:.1}", stat.used()?),
30 point.mount_point()?
31 );
32
33 Some(())
34}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FsStat
impl RefUnwindSafe for FsStat
impl Send for FsStat
impl Sync for FsStat
impl Unpin for FsStat
impl UnwindSafe for FsStat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more