implemented Display for TallyID

This commit is contained in:
Djeeberjr 2025-10-11 14:31:26 +02:00
parent a8d64f6af5
commit f46cdc4d29

View File

@ -1,4 +1,4 @@
use core::str::FromStr;
use core::{fmt::Display, str::FromStr};
use serde::{Deserialize, Deserializer, Serialize, Serializer, de};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
@ -72,6 +72,13 @@ impl TryFrom<&[u8]> for TallyID {
}
}
impl Display for TallyID {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let s: heapless::String<12> = (*self).into();
write!(f, "{}", s)
}
}
impl Serialize for TallyID {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where