pub struct MountPoint<'a> { /* private fields */ }

Implementations§

source§

impl<'a> MountPoint<'a>

source

pub fn values(&self) -> impl Iterator<Item = &'a str>

Returns every value separated by a space.

source

pub fn mount_id(&self) -> Option<usize>

A unique ID for the mount (may be reused after umount).

source

pub fn parent_id(&self) -> Option<usize>

The ID of the parent mount (or of self for the root of this mount namespace’s mount tree).

source

pub fn major_minor(&self) -> Option<&'a str>

major:minor: the value of st_dev for files on this filesystem.

source

pub fn major(&self) -> Option<usize>

Gets the major value.

source

pub fn minor(&self) -> Option<usize>

Gets the minor value.

source

pub fn root(&self) -> Option<&'a str>

the pathname of the directory in the filesystem which forms the root of this mount.

source

pub fn mount_point(&self) -> Option<&'a str>

The pathname of the mount point relative to the process’s root directory.

Examples found in repository?
examples/df_h.rs (line 30)
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(())
}
source

pub fn mount_options(&self) -> Option<&'a str>

Per-mount options.

source

pub fn optional_fields( &self ) -> impl Iterator<Item = (&'a str, Option<&'a str>)>

Currently, the possible optional fields are shared, master, propagate_from, and unbindable.

source

pub fn filesystem_type(&self) -> Option<&'a str>

The filesystem type in the form “type[.subtype]”.

source

pub fn mount_source(&self) -> Option<&'a str>

Filesystem-specific information.
df command uses this information as Filesystem.

Examples found in repository?
examples/df_h.rs (line 26)
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(())
}
source

pub fn super_options(&self) -> Option<&'a str>

Per-superblock options.

source

pub fn stats(&self) -> Result<FsStat>

Returns the filesystem statistics of this mount point.

Examples found in repository?
examples/df_h.rs (line 18)
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§

source§

impl<'a> Clone for MountPoint<'a>

source§

fn clone(&self) -> MountPoint<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for MountPoint<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> PartialEq for MountPoint<'a>

source§

fn eq(&self, other: &MountPoint<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for MountPoint<'a>

source§

impl<'a> StructuralPartialEq for MountPoint<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for MountPoint<'a>

§

impl<'a> Send for MountPoint<'a>

§

impl<'a> Sync for MountPoint<'a>

§

impl<'a> Unpin for MountPoint<'a>

§

impl<'a> UnwindSafe for MountPoint<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.