Struct linux_info::storage::FsStat

source ·
pub struct FsStat { /* private fields */ }
Expand description

Filesystem statistics

Implementations§

Reads filesystems staticstics for a given file descriptor.

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(())
}

The block size in bytes used for this filesystem.

The total block count.

The blocks that are still free may not all be accessible to unprivileged users.

The blocks that are free and accessible to unprivileged users.

The blocks that are already used.

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(())
}

The size of the free space.

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(())
}

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(())
}

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.