mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 12:31:17 +00:00
Make Ss58AddressFormat display less expressive (#6941)
Instead of using the `Debug` implementation inside the `Display` implementation this pr changes it to display only the name of the format.
This commit is contained in:
@@ -328,7 +328,13 @@ macro_rules! ss58_address_format {
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl std::fmt::Display for Ss58AddressFormat {
|
impl std::fmt::Display for Ss58AddressFormat {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
write!(f, "{:?}", self)
|
match self {
|
||||||
|
$(
|
||||||
|
Ss58AddressFormat::$identifier => write!(f, "{}", $name),
|
||||||
|
)*
|
||||||
|
Ss58AddressFormat::Custom(x) => write!(f, "{}", x),
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,10 +425,7 @@ macro_rules! ss58_address_format {
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl From<Ss58AddressFormat> for String {
|
impl From<Ss58AddressFormat> for String {
|
||||||
fn from(x: Ss58AddressFormat) -> String {
|
fn from(x: Ss58AddressFormat) -> String {
|
||||||
match x {
|
x.to_string()
|
||||||
$(Ss58AddressFormat::$identifier => $name.into()),*,
|
|
||||||
Ss58AddressFormat::Custom(x) => x.to_string(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user