Impl Debug and Display for Ss58AddressFormat when compiled with std
* Initial commit
Forked at:
Parent branch: origin/master
* Impl Debug and Display for Ss58AddressFormat when compiled with std
Fixes
* Use write! instead of writeln!
@@ -357,12 +357,20 @@ macro_rules! ss58_address_format {
( $( $identifier:tt => ($number:expr, $name:expr, $desc:tt) )* ) => (
/// A known address (sub)format/network ID for SS58.
#[derive(Copy, Clone, PartialEq, Eq)]
+ #[cfg_attr(feature = "std", derive(Debug))]
pub enum Ss58AddressFormat {
$(#[doc = $desc] $identifier),*,
/// Use a manually provided numeric value.
Custom(u8),
}
+ #[cfg(feature = "std")]
+ impl std::fmt::Display for Ss58AddressFormat {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ write!(f, "{:?}", self)
+ }
+ }
+
static ALL_SS58_ADDRESS_FORMATS: [Ss58AddressFormat; 0 $(+ { let _ = $number; 1})*] = [
$(Ss58AddressFormat::$identifier),*,
];
