diff --git a/src/lib.rs b/src/lib.rs index 3a2c4fb..69ac1f1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -330,9 +330,7 @@ impl From for Network { } } -uniffi::custom_type!(Txid, String); -impl_string_custom_typedef!(Txid); -uniffi::custom_type!(BlockHash, String); -impl_string_custom_typedef!(BlockHash); +define_custom_string_type!(Txid); +define_custom_string_type!(BlockHash); uniffi::setup_scaffolding!("bitcoin"); diff --git a/src/macros.rs b/src/macros.rs index 7816ab4..cfd2371 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -18,8 +18,10 @@ macro_rules! impl_from_ffi_type { }; } -macro_rules! impl_string_custom_typedef { +macro_rules! define_custom_string_type { ($ffi_type:ident) => { + uniffi::custom_type!($ffi_type, String); + impl UniffiCustomTypeConverter for $ffi_type { type Builtin = String; fn into_custom(val: Self::Builtin) -> uniffi::Result {