From 9aae14cdf4e50907805303c60cc96b6b2fff788e Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 13 Dec 2024 07:43:35 +0100 Subject: [PATCH] Shorter `Debug` formatting of `LayerId` --- crates/egui/src/layers.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/layers.rs b/crates/egui/src/layers.rs index 595f67034f5..1133f13a97b 100644 --- a/crates/egui/src/layers.rs +++ b/crates/egui/src/layers.rs @@ -60,7 +60,7 @@ impl Order { /// An identifier for a paint layer. /// Also acts as an identifier for [`crate::Area`]:s. -#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)] +#[derive(Clone, Copy, Hash, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct LayerId { pub order: Order, @@ -102,6 +102,13 @@ impl LayerId { } } +impl std::fmt::Debug for LayerId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let Self { order, id } = self; + write!(f, "LayerId {{ {order:?} {id:?} }}") + } +} + /// A unique identifier of a specific [`Shape`] in a [`PaintList`]. #[derive(Clone, Copy, Debug, PartialEq, Eq)]