Use SI metrics for memory in system_information example
This commit is contained in:
parent
edb5a66c53
commit
8694eeb5c5
1 changed files with 9 additions and 9 deletions
|
|
@ -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}");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue