Merge pull request #2223 from brianch/fix-sysinfo-example
Small fix to the Information struct docs and fix memory info. in the system_information example.
This commit is contained in:
commit
1049fbbb1c
3 changed files with 9 additions and 6 deletions
|
|
@ -81,6 +81,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Clippy map transformations. [#2090](https://github.com/iced-rs/iced/pull/2090)
|
- Clippy map transformations. [#2090](https://github.com/iced-rs/iced/pull/2090)
|
||||||
- Inline format args for ease of reading. [#2089](https://github.com/iced-rs/iced/pull/2089)
|
- Inline format args for ease of reading. [#2089](https://github.com/iced-rs/iced/pull/2089)
|
||||||
- Stuck scrolling in `Scrollable` with touch events. [#1940](https://github.com/iced-rs/iced/pull/1940)
|
- Stuck scrolling in `Scrollable` with touch events. [#1940](https://github.com/iced-rs/iced/pull/1940)
|
||||||
|
- Incorrect unit in `system::Information`. [#2223](https://github.com/iced-rs/iced/pull/2223)
|
||||||
|
|
||||||
Many thanks to...
|
Many thanks to...
|
||||||
|
|
||||||
|
|
@ -89,6 +90,7 @@ Many thanks to...
|
||||||
- @arslee07
|
- @arslee07
|
||||||
- @AustinMReppert
|
- @AustinMReppert
|
||||||
- @avsaase
|
- @avsaase
|
||||||
|
- @brianch
|
||||||
- @bungoboingo
|
- @bungoboingo
|
||||||
- @Calastrophe
|
- @Calastrophe
|
||||||
- @casperstorm
|
- @casperstorm
|
||||||
|
|
@ -114,6 +116,7 @@ Many thanks to...
|
||||||
- @nyurik
|
- @nyurik
|
||||||
- @Remmirad
|
- @Remmirad
|
||||||
- @ripytide
|
- @ripytide
|
||||||
|
- @Tahinli
|
||||||
- @tarkah
|
- @tarkah
|
||||||
- @tzemanovic
|
- @tzemanovic
|
||||||
- @william-shere
|
- @william-shere
|
||||||
|
|
|
||||||
|
|
@ -102,19 +102,19 @@ impl Application for Example {
|
||||||
));
|
));
|
||||||
|
|
||||||
let memory_readable =
|
let memory_readable =
|
||||||
ByteSize::kb(information.memory_total).to_string();
|
ByteSize::b(information.memory_total).to_string();
|
||||||
|
|
||||||
let memory_total = text(format!(
|
let memory_total = text(format!(
|
||||||
"Memory (total): {} kb ({memory_readable})",
|
"Memory (total): {} bytes ({memory_readable})",
|
||||||
information.memory_total,
|
information.memory_total,
|
||||||
));
|
));
|
||||||
|
|
||||||
let memory_text = if let Some(memory_used) =
|
let memory_text = if let Some(memory_used) =
|
||||||
information.memory_used
|
information.memory_used
|
||||||
{
|
{
|
||||||
let memory_readable = ByteSize::kb(memory_used).to_string();
|
let memory_readable = ByteSize::b(memory_used).to_string();
|
||||||
|
|
||||||
format!("{memory_used} kb ({memory_readable})")
|
format!("{memory_used} bytes ({memory_readable})")
|
||||||
} else {
|
} else {
|
||||||
String::from("None")
|
String::from("None")
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ pub struct Information {
|
||||||
pub cpu_brand: String,
|
pub cpu_brand: String,
|
||||||
/// The number of physical cores on the processor
|
/// The number of physical cores on the processor
|
||||||
pub cpu_cores: Option<usize>,
|
pub cpu_cores: Option<usize>,
|
||||||
/// Total RAM size, KB
|
/// Total RAM size, in bytes
|
||||||
pub memory_total: u64,
|
pub memory_total: u64,
|
||||||
/// Memory used by this process, KB
|
/// Memory used by this process, in bytes
|
||||||
pub memory_used: Option<u64>,
|
pub memory_used: Option<u64>,
|
||||||
/// Underlying graphics backend for rendering
|
/// Underlying graphics backend for rendering
|
||||||
pub graphics_backend: String,
|
pub graphics_backend: String,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue