diff --git a/src/types.rs b/src/types.rs index 4f368ef..34db69d 100644 --- a/src/types.rs +++ b/src/types.rs @@ -260,17 +260,28 @@ where } } -impl ToString for HWIDeviceType { - fn to_string(&self) -> String { +struct Point { + x: usize, + y: usize, +} + +impl std::fmt::Display for Point { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "({}, {})", self.x, self.y) + } +} + +impl std::fmt::Display for HWIDeviceType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Self::Ledger => String::from("ledger"), - Self::Trezor => String::from("trezor"), - Self::BitBox01 => String::from("digitalbitbox"), - Self::BitBox02 => String::from("bitbox02"), - Self::KeepKey => String::from("keepkey"), - Self::Coldcard => String::from("coldcard"), - Self::Jade => String::from("jade"), - Self::Other(name) => name.to_string(), + HWIDeviceType::Ledger => write!(f, "ledger"), + HWIDeviceType::Trezor => write!(f, "trezor"), + HWIDeviceType::BitBox01 => write!(f, "digitalbitbox"), + HWIDeviceType::BitBox02 => write!(f, "bitbox02"), + HWIDeviceType::KeepKey => write!(f, "keepkey"), + HWIDeviceType::Coldcard => write!(f, "coldcard"), + HWIDeviceType::Jade => write!(f, "jade"), + HWIDeviceType::Other(name) => write!(f, "{}", name.to_string()), } } }