bindings: Use async-compat tokio runtime

This commit is contained in:
Jonas Platte 2023-01-11 12:26:09 +01:00 committed by Jonas Platte
parent 587c5b05b1
commit ffc8453c63
4 changed files with 20 additions and 9 deletions

13
Cargo.lock generated
View File

@ -240,6 +240,18 @@ dependencies = [
"futures-core",
]
[[package]]
name = "async-compat"
version = "0.2.1"
source = "git+https://github.com/jplatte/async-compat?rev=b83b197622d8b5756d3594ce73b720896b07faae#b83b197622d8b5756d3594ce73b720896b07faae"
dependencies = [
"futures-core",
"futures-io",
"once_cell",
"pin-project-lite",
"tokio",
]
[[package]]
name = "async-compression"
version = "0.4.0"
@ -2782,6 +2794,7 @@ name = "matrix-sdk-ffi"
version = "0.2.0"
dependencies = [
"anyhow",
"async-compat",
"base64 0.21.0",
"extension-trait",
"eyeball",

View File

@ -79,3 +79,6 @@ incremental = false
# Compile all non-workspace crate in the dependency tree with optimizations
[profile.reldbg.package."*"]
opt-level = 3
[patch.crates-io]
async-compat = { git = "https://github.com/jplatte/async-compat", rev = "b83b197622d8b5756d3594ce73b720896b07faae" }

View File

@ -22,6 +22,7 @@ vergen = { version = "8.1.3", features = ["build", "git", "gitcl"] }
[dependencies]
anyhow = { workspace = true }
async-compat = "0.2.1"
base64 = "0.21"
eyeball = { workspace = true }
eyeball-im = { workspace = true }

View File

@ -36,15 +36,7 @@ pub mod sliding_sync;
pub mod timeline;
pub mod tracing;
use once_cell::sync::Lazy;
use tokio::runtime::Runtime;
// Re-exports for more convenient use inside other submodules
use self::{client::Client, error::ClientError};
pub static RUNTIME: Lazy<Runtime> =
Lazy::new(|| Runtime::new().expect("Can't start Tokio runtime"));
use async_compat::TOKIO1 as RUNTIME;
pub use matrix_sdk::ruma::{api::client::account::register, UserId};
pub use matrix_sdk_ui::timeline::PaginationOutcome;
pub use platform::*;
@ -53,6 +45,8 @@ pub use self::{
authentication_service::*, client::*, event::*, notification::*, room::*, room_member::*,
session_verification::*, sliding_sync::*, timeline::*, tracing::*,
};
// Re-exports for more convenient use inside other submodules
use self::{client::Client, error::ClientError};
uniffi::include_scaffolding!("api");