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,17 +102,17 @@ impl Example {
); );
let memory_readable = let memory_readable =
ByteSize::b(information.memory_total).to_string(); ByteSize::b(information.memory_total).to_string_as(true);
let memory_total = text!( let memory_total = text!(
"Memory (total): {} bytes ({memory_readable})", "Memory (total): {} bytes ({memory_readable})",
information.memory_total, information.memory_total,
); );
let memory_text = if let Some(memory_used) = let memory_text =
information.memory_used if let Some(memory_used) = information.memory_used {
{ let memory_readable =
let memory_readable = ByteSize::b(memory_used).to_string(); ByteSize::b(memory_used).to_string_as(true);
format!("{memory_used} bytes ({memory_readable})") format!("{memory_used} bytes ({memory_readable})")
} else { } else {