chore: more concise Debug output for WindowId

This commit is contained in:
Bruce Mitchener 2024-04-15 00:06:18 +07:00 committed by GitHub
parent 0086d7153b
commit df7c496a5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -77,6 +77,7 @@ changelog entry.
- Rename `platform::x11::XWindowType` to `platform::x11::WindowType`. - Rename `platform::x11::XWindowType` to `platform::x11::WindowType`.
- Rename `VideoMode` to `VideoModeHandle` to represent that it doesn't hold - Rename `VideoMode` to `VideoModeHandle` to represent that it doesn't hold
static data. static data.
- Make `Debug` formatting of `WindowId` more concise.
- Move `dpi` types to its own crate, and re-export it from the root crate. - 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 - Replace `log` with `tracing`, use `log` feature on `tracing` to restore old
behavior. behavior.

View file

@ -67,7 +67,7 @@ impl Drop for Window {
/// ///
/// Whenever you receive an event specific to a window, this event contains a `WindowId` which you /// 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. /// 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); pub struct WindowId(pub(crate) platform_impl::WindowId);
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<WindowId> for u64 { impl From<WindowId> for u64 {
fn from(window_id: WindowId) -> Self { fn from(window_id: WindowId) -> Self {
window_id.0.into() window_id.0.into()