Use SI metrics for memory in system_information example

This commit is contained in:
Héctor Ramón Jiménez 2025-02-15 14:06:10 +01:00
parent edb5a66c53
commit 8694eeb5c5
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -102,22 +102,22 @@ impl Example {
);
let memory_readable =
ByteSize::b(information.memory_total).to_string();
ByteSize::b(information.memory_total).to_string_as(true);
let memory_total = text!(
"Memory (total): {} bytes ({memory_readable})",
information.memory_total,
);
let memory_text = if let Some(memory_used) =
information.memory_used
{
let memory_readable = ByteSize::b(memory_used).to_string();
let memory_text =
if let Some(memory_used) = information.memory_used {
let memory_readable =
ByteSize::b(memory_used).to_string_as(true);
format!("{memory_used} bytes ({memory_readable})")
} else {
String::from("None")
};
format!("{memory_used} bytes ({memory_readable})")
} else {
String::from("None")
};
let memory_used = text!("Memory (used): {memory_text}");