Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fix to the Information struct docs and fix memory info. in the system_information example. #2223

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
- 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)
- Incorrect unit in `system::Information`. [#2223](https://github.com/iced-rs/iced/pull/2223)

Many thanks to...

Expand All @@ -89,6 +90,7 @@ Many thanks to...
- @arslee07
- @AustinMReppert
- @avsaase
- @brianch
- @bungoboingo
- @Calastrophe
- @casperstorm
Expand All @@ -114,6 +116,7 @@ Many thanks to...
- @nyurik
- @Remmirad
- @ripytide
- @Tahinli
- @tarkah
- @tzemanovic
- @william-shere
Expand Down
8 changes: 4 additions & 4 deletions examples/system_information/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ impl Application for Example {
));

let memory_readable =
ByteSize::kb(information.memory_total).to_string();
ByteSize::b(information.memory_total).to_string();

let memory_total = text(format!(
"Memory (total): {} kb ({memory_readable})",
"Memory (total): {} bytes ({memory_readable})",
information.memory_total,
));

let memory_text = if let Some(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 {
String::from("None")
};
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/system/information.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ pub struct Information {
pub cpu_brand: String,
/// The number of physical cores on the processor
pub cpu_cores: Option<usize>,
/// Total RAM size, KB
/// Total RAM size, in bytes
pub memory_total: u64,
/// Memory used by this process, KB
/// Memory used by this process, in bytes
pub memory_used: Option<u64>,
/// Underlying graphics backend for rendering
pub graphics_backend: String,
Expand Down
Loading