mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Impl Debug and Display for Ss58AddressFormat when compiled with std (#6327)
* Initial commit
Forked at: f5caf030aa
Parent branch: origin/master
* Impl Debug and Display for Ss58AddressFormat when compiled with std
Fixes #6289
* Use write! instead of writeln!
This commit is contained in:
@@ -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),*,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user