Improve `Debug` format of `Sense`, `WidgetInfo` and `Id`
This commit is contained in:
parent
95b62ce144
commit
a97134d66c
|
|
@ -504,7 +504,10 @@ impl std::fmt::Debug for WidgetInfo {
|
||||||
let mut s = f.debug_struct("WidgetInfo");
|
let mut s = f.debug_struct("WidgetInfo");
|
||||||
|
|
||||||
s.field("typ", typ);
|
s.field("typ", typ);
|
||||||
s.field("enabled", enabled);
|
|
||||||
|
if !enabled {
|
||||||
|
s.field("enabled", enabled);
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(label) = label {
|
if let Some(label) = label {
|
||||||
s.field("label", label);
|
s.field("label", label);
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ impl Id {
|
||||||
|
|
||||||
impl std::fmt::Debug for Id {
|
impl std::fmt::Debug for Id {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{:016X}", self.0)
|
write!(f, "{:04X}", self.value() as u16)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/// What sort of interaction is a widget sensitive to?
|
/// What sort of interaction is a widget sensitive to?
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||||
// #[cfg_attr(feature = "serde", derive(serde::Serialize))]
|
// #[cfg_attr(feature = "serde", derive(serde::Serialize))]
|
||||||
pub struct Sense {
|
pub struct Sense {
|
||||||
/// Buttons, sliders, windows, …
|
/// Buttons, sliders, windows, …
|
||||||
|
|
@ -15,6 +15,28 @@ pub struct Sense {
|
||||||
pub focusable: bool,
|
pub focusable: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Debug for Sense {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
let Self {
|
||||||
|
click,
|
||||||
|
drag,
|
||||||
|
focusable,
|
||||||
|
} = self;
|
||||||
|
|
||||||
|
write!(f, "Sense {{")?;
|
||||||
|
if *click {
|
||||||
|
write!(f, " click")?;
|
||||||
|
}
|
||||||
|
if *drag {
|
||||||
|
write!(f, " drag")?;
|
||||||
|
}
|
||||||
|
if *focusable {
|
||||||
|
write!(f, " focusable")?;
|
||||||
|
}
|
||||||
|
write!(f, " }}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Sense {
|
impl Sense {
|
||||||
/// Senses no clicks or drags. Only senses mouse hover.
|
/// Senses no clicks or drags. Only senses mouse hover.
|
||||||
#[doc(alias = "none")]
|
#[doc(alias = "none")]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue