From 7af2bea2fc56bce7123e4ce0bd3a87ce23271605 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 11 Jan 2023 12:23:18 +0100 Subject: [PATCH] Upgrade UniFFI --- Cargo.lock | 27 +++++++------------ Cargo.toml | 4 +-- .../src/backup_recovery_key.rs | 5 ++-- bindings/matrix-sdk-crypto-ffi/src/error.rs | 3 +-- bindings/matrix-sdk-crypto-ffi/src/lib.rs | 1 + .../matrix-sdk-crypto-ffi/src/responses.rs | 2 +- bindings/matrix-sdk-ffi/src/room.rs | 2 +- bindings/matrix-sdk-ffi/src/sliding_sync.rs | 3 +-- 8 files changed, 18 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0fca4f785..5a86e9ded 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5652,8 +5652,7 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "uniffi" version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f71cc01459bc34cfe43fabf32b39f1228709bc6db1b3a664a92940af3d062376" +source = "git+https://github.com/mozilla/uniffi-rs?rev=58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4#58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" dependencies = [ "anyhow", "camino", @@ -5674,8 +5673,7 @@ dependencies = [ [[package]] name = "uniffi_bindgen" version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbbba5103051c18f10b22f80a74439ddf7100273f217a547005d2735b2498994" +source = "git+https://github.com/mozilla/uniffi-rs?rev=58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4#58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" dependencies = [ "anyhow", "askama", @@ -5698,8 +5696,7 @@ dependencies = [ [[package]] name = "uniffi_build" version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1a28368ff3d83717e3d3e2e15a66269c43488c3f036914131bb68892f29fb" +source = "git+https://github.com/mozilla/uniffi-rs?rev=58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4#58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" dependencies = [ "anyhow", "camino", @@ -5709,8 +5706,7 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03de61393a42b4ad4984a3763c0600594ac3e57e5aaa1d05cede933958987c03" +source = "git+https://github.com/mozilla/uniffi-rs?rev=58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4#58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" dependencies = [ "quote", "syn", @@ -5719,8 +5715,7 @@ dependencies = [ [[package]] name = "uniffi_core" version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2b4852d638d74ca2d70e450475efb6d91fe6d54a7cd8d6bd80ad2ee6cd7daa" +source = "git+https://github.com/mozilla/uniffi-rs?rev=58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4#58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" dependencies = [ "anyhow", "bytes", @@ -5735,8 +5730,7 @@ dependencies = [ [[package]] name = "uniffi_macros" version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa03394de21e759e0022f1ea8d992d2e39290d735b9ed52b1f74b20a684f794e" +source = "git+https://github.com/mozilla/uniffi-rs?rev=58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4#58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" dependencies = [ "bincode", "camino", @@ -5754,8 +5748,7 @@ dependencies = [ [[package]] name = "uniffi_meta" version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66fdab2c436aed7a6391bec64204ec33948bfed9b11b303235740771f85c4ea6" +source = "git+https://github.com/mozilla/uniffi-rs?rev=58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4#58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" dependencies = [ "serde", "siphasher", @@ -5765,8 +5758,7 @@ dependencies = [ [[package]] name = "uniffi_testing" version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b0570953ec41d97ce23e3b92161ac18231670a1f97523258a6d2ab76d7f76c" +source = "git+https://github.com/mozilla/uniffi-rs?rev=58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4#58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" dependencies = [ "anyhow", "camino", @@ -6050,8 +6042,7 @@ dependencies = [ [[package]] name = "weedle2" version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e79c5206e1f43a2306fd64bdb95025ee4228960f2e6c5a8b173f3caaf807741" +source = "git+https://github.com/mozilla/uniffi-rs?rev=58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4#58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" dependencies = [ "nom", ] diff --git a/Cargo.toml b/Cargo.toml index d1a7d1b37..596ae59a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,8 +38,8 @@ serde_html_form = "0.2.0" serde_json = "1.0.91" thiserror = "1.0.38" tracing = { version = "0.1.36", default-features = false, features = ["std"] } -uniffi = "0.23.0" -uniffi_bindgen = "0.23.0" +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" } +uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "58758341b72e9e8ff51ecd57a3eb22d6cc41a4b4" } vodozemac = { git = "https://github.com/matrix-org/vodozemac", rev = "fb609ca1e4df5a7a818490ae86ac694119e41e71" } zeroize = "1.3.0" diff --git a/bindings/matrix-sdk-crypto-ffi/src/backup_recovery_key.rs b/bindings/matrix-sdk-crypto-ffi/src/backup_recovery_key.rs index 5cf6e3974..110406fb2 100644 --- a/bindings/matrix-sdk-crypto-ffi/src/backup_recovery_key.rs +++ b/bindings/matrix-sdk-crypto-ffi/src/backup_recovery_key.rs @@ -27,8 +27,7 @@ pub enum PkDecryptionError { } /// Error type for the decoding and storing of the backup key. -#[derive(Debug, Error, uniffi::Error)] -#[uniffi(flat_error)] +#[derive(Debug, Error)] pub enum DecodeError { /// An error happened while decoding the recovery key. #[error(transparent)] @@ -41,7 +40,7 @@ pub enum DecodeError { /// Struct containing info about the way the backup key got derived from a /// passphrase. -#[derive(Debug, Clone, uniffi::Record)] +#[derive(Debug, Clone)] pub struct PassphraseInfo { /// The salt that was used during key derivation. pub private_key_salt: String, diff --git a/bindings/matrix-sdk-crypto-ffi/src/error.rs b/bindings/matrix-sdk-crypto-ffi/src/error.rs index b4b0a41cd..6ae377a01 100644 --- a/bindings/matrix-sdk-crypto-ffi/src/error.rs +++ b/bindings/matrix-sdk-crypto-ffi/src/error.rs @@ -39,8 +39,7 @@ pub enum SignatureError { UnknownUserIdentity(String), } -#[derive(Debug, thiserror::Error, uniffi::Error)] -#[uniffi(flat_error)] +#[derive(Debug, thiserror::Error)] pub enum CryptoStoreError { #[error("Failed to open the store")] OpenStore(#[from] OpenStoreError), diff --git a/bindings/matrix-sdk-crypto-ffi/src/lib.rs b/bindings/matrix-sdk-crypto-ffi/src/lib.rs index 3925fdfc2..187e04d68 100644 --- a/bindings/matrix-sdk-crypto-ffi/src/lib.rs +++ b/bindings/matrix-sdk-crypto-ffi/src/lib.rs @@ -47,6 +47,7 @@ use ruma::{ }; use serde::{Deserialize, Serialize}; use tokio::runtime::Runtime; +use uniffi_api::*; pub use users::UserIdentity; pub use verification::{ CancelInfo, ConfirmVerificationResult, QrCode, QrCodeListener, QrCodeState, diff --git a/bindings/matrix-sdk-crypto-ffi/src/responses.rs b/bindings/matrix-sdk-crypto-ffi/src/responses.rs index 24a0c2c14..569def11a 100644 --- a/bindings/matrix-sdk-crypto-ffi/src/responses.rs +++ b/bindings/matrix-sdk-crypto-ffi/src/responses.rs @@ -112,7 +112,7 @@ impl From for OutgoingVerificationRequest { } } -#[derive(Debug, uniffi::Enum)] +#[derive(Debug)] pub enum Request { ToDevice { request_id: String, event_type: String, body: String }, KeysUpload { request_id: String, body: String }, diff --git a/bindings/matrix-sdk-ffi/src/room.rs b/bindings/matrix-sdk-ffi/src/room.rs index c9d700f10..f011e63aa 100644 --- a/bindings/matrix-sdk-ffi/src/room.rs +++ b/bindings/matrix-sdk-ffi/src/room.rs @@ -39,7 +39,7 @@ pub struct Room { timeline: TimelineLock, } -#[derive(Clone, uniffi::Enum)] +#[derive(Clone)] pub enum MembershipState { /// The user is banned. Ban, diff --git a/bindings/matrix-sdk-ffi/src/sliding_sync.rs b/bindings/matrix-sdk-ffi/src/sliding_sync.rs index a8c8ad0fe..d69a62466 100644 --- a/bindings/matrix-sdk-ffi/src/sliding_sync.rs +++ b/bindings/matrix-sdk-ffi/src/sliding_sync.rs @@ -254,7 +254,6 @@ pub struct UpdateSummary { pub rooms: Vec, } -#[derive(uniffi::Record)] pub struct RequiredState { pub key: String, pub value: String, @@ -324,7 +323,7 @@ impl From> for SlidingSyncListRoomsListDiff { } } -#[derive(Clone, Debug, uniffi::Enum)] +#[derive(Clone, Debug)] pub enum RoomListEntry { Empty, Invalidated { room_id: String },