pub struct MemoryStats {
pub ram: RamInfo,
pub swap: SwapInfo,
pub emc: Option<EmcInfo>,
pub iram: Option<IramInfo>,
}Expand description
Memory statistics
Fields§
§ram: RamInfoRAM information
swap: SwapInfoSWAP information
emc: Option<EmcInfo>EMC information (Jetson only)
iram: Option<IramInfo>IRAM information (Jetson only)
Implementations§
Source§impl MemoryStats
impl MemoryStats
Sourcepub fn empty() -> Self
pub fn empty() -> Self
A zeroed struct for a platform reader to fill in.
This reads nothing. It returns all zeros, and it was called new()
until 6.0.0 — a name that reads like a constructor that gathers
data. Two GUI defects, one in the HTTP server and one in the
library’s own snapshot_memory came from exactly that misreading,
found over three separate occasions.
The real values come from the per-platform readers. Use those unless you are a reader building your own starting struct.
Sourcepub fn ram_usage_percent(&self) -> Option<f32>
pub fn ram_usage_percent(&self) -> Option<f32>
RAM usage percentage, or None when no RAM total was read.
empty() and Default carry a total of zero, which is no reading, so
that answers None rather than 0.0.
Sourcepub fn swap_usage_percent(&self) -> Option<f32>
pub fn swap_usage_percent(&self) -> Option<f32>
SWAP usage percentage, or None when swap was not reported.
Returns Some(0.0) for a machine with no swap, which is a reading, and
None when the platform did not say — a caller that renders those the
same way is choosing to, rather than being unable to tell.
Sourcepub fn swap_usage_percent_or_zero(&self) -> f32
pub fn swap_usage_percent_or_zero(&self) -> f32
SWAP usage percentage for display, treating “not reported” as zero.
Named so the call site says it is making that choice. Every caller that used to get this silently now has to write it down.
Trait Implementations§
Source§impl Clone for MemoryStats
impl Clone for MemoryStats
Source§impl Debug for MemoryStats
impl Debug for MemoryStats
Source§impl Default for MemoryStats
impl Default for MemoryStats
Source§impl<'de> Deserialize<'de> for MemoryStats
impl<'de> Deserialize<'de> for MemoryStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for MemoryStats
impl RefUnwindSafe for MemoryStats
impl Send for MemoryStats
impl Sync for MemoryStats
impl Unpin for MemoryStats
impl UnsafeUnpin for MemoryStats
impl UnwindSafe for MemoryStats
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more