macro_rules! impl_pretty_debug {
($thing:ident) => {
impl core::fmt::Debug for $thing {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
write!(f, "{}(", stringify!($thing))?;
for i in &self[..] {
write!(f, "{:02x}", i)?;
}
f.write_str(")")
}
}
}
}
macro_rules! write_err {
($writer:expr, $string:literal $(, $args:expr),*; $source:expr) => {
{
#[cfg(feature = "std")]
{
let _ = &$source; write!($writer, $string $(, $args)*)
}
#[cfg(not(feature = "std"))]
{
write!($writer, concat!($string, ": {}") $(, $args)*, $source)
}
}
}
}