Skip to content

Commit 799459f

Browse files
committed
Define custom String type with complete macro
Separate `uniffi::custom_type` and `impl_string_custom_typedef` calls were made to define uniffi String types. This combines them into one macro.
1 parent 4c3c3b2 commit 799459f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,7 @@ impl From<Network> for bitcoin::Network {
338338
}
339339
}
340340

341-
uniffi::custom_type!(Txid, String);
342-
impl_string_custom_typedef!(Txid);
343-
uniffi::custom_type!(BlockHash, String);
344-
impl_string_custom_typedef!(BlockHash);
341+
define_custom_string_type!(Txid);
342+
define_custom_string_type!(BlockHash);
345343

346344
uniffi::setup_scaffolding!("bitcoin");

src/macros.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ macro_rules! impl_from_ffi_type {
1818
};
1919
}
2020

21-
macro_rules! impl_string_custom_typedef {
21+
macro_rules! define_custom_string_type {
2222
($ffi_type:ident) => {
23+
uniffi::custom_type!($ffi_type, String);
24+
2325
impl UniffiCustomTypeConverter for $ffi_type {
2426
type Builtin = String;
2527
fn into_custom(val: Self::Builtin) -> uniffi::Result<Self> {

0 commit comments

Comments
 (0)