commit 1425ebf0c6b13eedb69744215476b2cc8bb17386
parent 349ca744e7051138e16be9d902d095ae4c2cd125
Author: triesap <tyson@radroots.org>
Date: Sun, 9 Aug 2026 15:32:42 +0000
mobile: run exported futures in the Tokio context
- mark the complete UniFFI runtime surface as Tokio-compatible
- enable UniFFI's supported async runtime adapter
- preserve the foreign executor API and existing generated-language signatures
- verify mobile FFI tests, Clippy, formatting, and architecture contracts
Diffstat:
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -328,6 +328,19 @@ dependencies = [
]
[[package]]
+name = "async-compat"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1ba85bc55464dcbf728b56d97e119d673f4cf9062be330a9a26f3acf504a590"
+dependencies = [
+ "futures-core",
+ "futures-io",
+ "once_cell",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
name = "async-executor"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5895,6 +5908,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f38a9a27529ccff732f8efddb831b65b1e07f7dea3fd4cacd4a35a8c4b253b98"
dependencies = [
"anyhow",
+ "async-compat",
"bytes",
"once_cell",
"static_assertions",
diff --git a/crates/mobile_ffi/Cargo.toml b/crates/mobile_ffi/Cargo.toml
@@ -32,7 +32,7 @@ tracing = { workspace = true }
tracing-appender = { workspace = true }
tracing-subscriber = { workspace = true }
thiserror = { workspace = true }
-uniffi = { workspace = true }
+uniffi = { workspace = true, features = ["tokio"] }
[target.'cfg(unix)'.dependencies]
rustix = { workspace = true }
diff --git a/crates/mobile_ffi/src/runtime.rs b/crates/mobile_ffi/src/runtime.rs
@@ -43,7 +43,7 @@ pub struct RadrootsRuntime {
subscriptions: Arc<SubscriptionHub>,
}
-#[cfg_attr(not(coverage_nightly), uniffi::export)]
+#[cfg_attr(not(coverage_nightly), uniffi::export(async_runtime = "tokio"))]
impl RadrootsRuntime {
#[cfg_attr(not(coverage_nightly), uniffi::constructor)]
pub async fn new(