pub fn percent_free(&self) -> Result<f64> {
        match *self {
            MemInfo {
                total: Some(t),
                available: Some(a),
                ..
            } => Ok(a as f64 / t as f64 * 100.0),
            MemInfo {
                total: Some(t),
                free: Some(f),
                cached: Some(c),
                ..
            } => Ok((f + c) as f64 / t as f64 * 100.0),
            _ => Err(ProcFsError::InsufficientData(format!(
                "/proc/meminfo is missing one of \
                 total, available, free, or cached: \
                 {:?}",
                self
            ))),
        }
    }
/// Try to figure out how much memory is being used
///
/// Since linux kernel 3.16 this just performs
///
/// ```text
///     available / total * 100
/// ```
///
/// Before that we approximate available as Free + Cached, even though that
/// is [almost certain to be incorrect][].
///
/// [almost certain to be incorrect]: https://github.com/torvalds/linux/commit/34e431b0ae398fc54ea69ff85ec700722c9da773
Try to figure out how much memory is being used
Since linux kernel 3.16 this just performs



Before that we approximate available as Free + Cached, even though that
is [almost certain to be incorrect][].


Try to figure out how much memory is being used Since linux kernel 3 . 16 this just performs Before that we approximate available as Free + Cached even though that is [ almost certain to be incorrect ] [] .
pub fn percent_free(&self) -> Result<f64> {
        match *self {
            MemInfo {
                total: Some(t),
                available: Some(a),
                ..
            } => Ok(a as f64 / t as f64 * 100.0),
            MemInfo {
                total: Some(t),
                free: Some(f),
                cached: Some(c),
                ..
            } => Ok((f + c) as f64 / t as f64 * 100.0),
            _ => Err(ProcFsError::InsufficientData(format!(
                "/proc/meminfo is missing one of \
                 total, available, free, or cached: \
                 {:?}",
                self
            ))),
        }
    }
pub fn percent_free ( & self ) -> Result < f64 > { match * self { MemInfo { total : Some ( t ) , available : Some ( a ) , .. } => Ok ( a as f64 / t as f64 * 100.0 ) , MemInfo { total : Some ( t ) , free : Some ( f ) , cached : Some ( c ) , .. } => Ok ( ( f + c ) as f64 / t as f64 * 100.0 ) , _ => Err ( ProcFsError :: InsufficientData ( format ! ( " \
 \
 " self ) ) ) , } }
Try to figure out how much memory is being used
Since linux kernel 3.16 this just performs
Try to figure out how much memory is being used Since linux kernel 3 . 16 this just performs
&self
&self