Skip to content

Commit 99db72b

Browse files
authored
chore: uniffi 0.29.0
1 parent a019f3d commit 99db72b

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ default = ["uniffi/cli"]
1313

1414
[dependencies]
1515
bitcoin = { version = "0.32.4" }
16-
uniffi = { version = "=0.28.2" }
16+
uniffi = { version = "=0.29.0" }
1717
thiserror = "1.0.58"
1818

1919
[build-dependencies]
20-
uniffi = { version = "=0.28.2", features = ["build"] }
20+
uniffi = { version = "=0.29.0", features = ["build"] }

src/bitcoin.udl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace bitcoin {};
22

3-
[NonExhaustive]
3+
[NonExhaustive, Remote]
44
enum Network {
55
"Bitcoin",
66
"Testnet",

src/macros.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,16 @@ macro_rules! impl_from_ffi_type {
1818
};
1919
}
2020

21+
#[macro_export]
2122
macro_rules! define_custom_string_type {
2223
($ffi_type:ident) => {
23-
uniffi::custom_type!($ffi_type, String);
24-
25-
impl UniffiCustomTypeConverter for $ffi_type {
26-
type Builtin = String;
27-
fn into_custom(val: Self::Builtin) -> uniffi::Result<Self> {
28-
Ok(val.parse::<$ffi_type>()?)
29-
}
30-
31-
fn from_custom(obj: Self) -> Self::Builtin {
32-
obj.to_string()
33-
}
34-
}
24+
uniffi::custom_type!($ffi_type, String, {
25+
remote,
26+
lower: |value: $ffi_type| value.to_string(),
27+
try_lift: |value: String| value.parse()
28+
.map_err(|_| uniffi::deps::anyhow::Error::msg(
29+
format!("Failed to parse {} from string", stringify!($ffi_type))
30+
)),
31+
});
3532
};
3633
}

uniffi-bindgen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ version = "0.1.0"
66
edition = "2021"
77

88
[dependencies]
9-
uniffi = { version = "0.28.0", features = ["cli"] }
9+
uniffi = { version = "0.29.0", features = ["cli"] }

0 commit comments

Comments
 (0)