#[non_exhaustive]pub struct Memory {
pub total: Bytes,
pub used: Bytes,
pub free: Bytes,
pub host_total: Bytes,
pub host_free: Bytes,
pub unused: Option<Bytes>,
pub cached: Option<Bytes>,
pub limit: Option<MemoryLimit>,
pub swap: Swap,
pub source: MemorySource,
}Expand description
Every memory value from one set of reads; see snapshot.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.total: BytesWhat this process may use: the host’s memory, or the container’s limit when that is smaller.
used: BytesIn use, counted against total.
free: BytesAvailable to new allocations without swapping (reclaimable cache counts
as available). used + free == total always holds.
host_total: BytesThe machine’s memory, ignoring any limit.
host_free: BytesAvailable on the machine, ignoring any limit.
unused: Option<Bytes>Pages doing nothing at all (the kernel’s MemFree), when reported.
cached: Option<Bytes>File cache that can be reclaimed, when reported. Windows: None, as
the only documented source counts every handle on the machine; its
available memory already includes the standby cache.
limit: Option<MemoryLimit>The limit applied to total, when there is one.
swap: SwapSwap space (all zero when there is none).
source: MemorySourceWhere total and used came from.
Implementations§
Source§impl Memory
impl Memory
Sourcepub fn used_percent(&self) -> Percent
pub fn used_percent(&self) -> Percent
used as a share of total.
Sourcepub fn free_percent(&self) -> Percent
pub fn free_percent(&self) -> Percent
free as a share of total.