Skip to content

Commit 055e343

Browse files
feat: implement display trait for FeeRate type
1 parent 03278f4 commit 055e343

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bdk-ffi/src/bitcoin.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ impl HashableOutPoint {
121121
/// This is an integer type representing fee rate in sat/kwu. It provides protection against mixing
122122
/// up the types as well as basic formatting features.
123123
#[derive(Clone, Debug, uniffi::Object)]
124+
#[uniffi::export(Display)]
124125
pub struct FeeRate(pub BdkFeeRate);
125126

126127
#[uniffi::export]
@@ -157,6 +158,12 @@ impl FeeRate {
157158
}
158159
}
159160

161+
impl Display for FeeRate {
162+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
163+
write!(f, "{} sat/kwu", self.0)
164+
}
165+
}
166+
160167
impl_from_core_type!(BdkFeeRate, FeeRate);
161168
impl_into_core_type!(FeeRate, BdkFeeRate);
162169

0 commit comments

Comments
 (0)