From df7c496a5dab6e7e643efbfc64d55dd014132414 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 15 Apr 2024 00:06:18 +0700 Subject: [PATCH] chore: more concise `Debug` output for `WindowId` --- src/changelog/unreleased.md | 1 + src/window.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/changelog/unreleased.md b/src/changelog/unreleased.md index f19d4c0b..9a230aef 100644 --- a/src/changelog/unreleased.md +++ b/src/changelog/unreleased.md @@ -77,6 +77,7 @@ changelog entry. - Rename `platform::x11::XWindowType` to `platform::x11::WindowType`. - Rename `VideoMode` to `VideoModeHandle` to represent that it doesn't hold static data. +- Make `Debug` formatting of `WindowId` more concise. - Move `dpi` types to its own crate, and re-export it from the root crate. - Replace `log` with `tracing`, use `log` feature on `tracing` to restore old behavior. diff --git a/src/window.rs b/src/window.rs index 9458a476..03040889 100644 --- a/src/window.rs +++ b/src/window.rs @@ -67,7 +67,7 @@ impl Drop for Window { /// /// Whenever you receive an event specific to a window, this event contains a `WindowId` which you /// can then compare to the ids of your windows. -#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct WindowId(pub(crate) platform_impl::WindowId); impl WindowId { @@ -86,6 +86,12 @@ impl WindowId { } } +impl fmt::Debug for WindowId { + fn fmt(&self, fmtr: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.fmt(fmtr) + } +} + impl From for u64 { fn from(window_id: WindowId) -> Self { window_id.0.into()