Skip to content

Commit 6209bd1

Browse files
authored
feat(bip0032): impl Display for Version (#113)
1 parent 3b12a48 commit 6209bd1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

bip0032/src/xkey/payload/version.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Version bytes for extended key payloads.
22
3+
use core::fmt;
4+
35
/// Extended key version bytes.
46
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
57
pub enum Version {
@@ -9,6 +11,12 @@ pub enum Version {
911
Private(u32),
1012
}
1113

14+
impl fmt::Display for Version {
15+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16+
write!(f, "0x{:08X}", self.as_u32())
17+
}
18+
}
19+
1220
impl Version {
1321
/// Creates a public version from raw version bytes.
1422
pub const fn public(value: u32) -> Self {

0 commit comments

Comments
 (0)