From 1168c39c20653feda4293cfa78e48dcf73ede37a Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Mon, 7 Jun 2021 17:33:08 +0200 Subject: [PATCH] Move ruma re-export from matrix-sdk-common to matrix-sdk --- matrix_sdk/Cargo.toml | 4 +-- matrix_sdk/src/lib.rs | 17 +++++++++++++ matrix_sdk_common/Cargo.toml | 15 +++-------- .../src/deserialized_responses.rs | 25 +++++++------------ matrix_sdk_common/src/lib.rs | 17 ------------- 5 files changed, 32 insertions(+), 46 deletions(-) diff --git a/matrix_sdk/Cargo.toml b/matrix_sdk/Cargo.toml index 0884944b..86c41c06 100644 --- a/matrix_sdk/Cargo.toml +++ b/matrix_sdk/Cargo.toml @@ -26,7 +26,7 @@ rustls-tls = ["reqwest/rustls-tls"] socks = ["reqwest/socks"] sso_login = ["warp", "rand", "tokio-stream"] require_auth_for_profile_requests = [] -appservice = ["matrix-sdk-common/appservice", "ruma/appservice-api-s", "ruma/appservice-api-helper", "ruma/rand"] +appservice = ["ruma/appservice-api-s", "ruma/appservice-api-helper", "ruma/rand"] docs = ["encryption", "sled_cryptostore", "sled_state_store", "sso_login"] @@ -56,7 +56,7 @@ default_features = false [dependencies.ruma] version = "0.1.2" -features = ["client-api-c", "unstable-pre-spec"] +features = ["client-api-c", "compat", "unstable-pre-spec"] [dependencies.tokio-stream] version = "0.1.4" diff --git a/matrix_sdk/src/lib.rs b/matrix_sdk/src/lib.rs index cb3892e5..4473662e 100644 --- a/matrix_sdk/src/lib.rs +++ b/matrix_sdk/src/lib.rs @@ -85,6 +85,23 @@ pub use matrix_sdk_base::{ }; pub use matrix_sdk_common::*; pub use reqwest; +#[cfg(feature = "appservice")] +pub use ruma::{ + api::{appservice as api_appservice, IncomingRequest, OutgoingRequestAppserviceExt}, + serde::{exports::serde::de::value::Error as SerdeError, urlencoded}, +}; +pub use ruma::{ + api::{ + client as api, + error::{ + FromHttpRequestError, FromHttpResponseError, IntoHttpError, MatrixError, ServerError, + }, + AuthScheme, EndpointError, IncomingResponse, OutgoingRequest, SendAccessToken, + }, + assign, directory, encryption, events, identifiers, int, presence, push, receipt, + serde::{CanonicalJsonValue, Raw}, + thirdparty, uint, Int, MilliSecondsSinceUnixEpoch, Outgoing, SecondsSinceUnixEpoch, UInt, +}; mod client; mod error; diff --git a/matrix_sdk_common/Cargo.toml b/matrix_sdk_common/Cargo.toml index 901d2724..4839c98a 100644 --- a/matrix_sdk_common/Cargo.toml +++ b/matrix_sdk_common/Cargo.toml @@ -10,18 +10,11 @@ readme = "README.md" repository = "https://github.com/matrix-org/matrix-rust-sdk" version = "0.2.0" -[features] -markdown = ["ruma/markdown"] -appservice = ["ruma/appservice-api", "ruma/appservice-api-helper", "ruma/rand"] - [dependencies] -instant = { version = "0.1.9", features = ["wasm-bindgen", "now"] } -serde = "1.0.122" async-trait = "0.1.42" - -[dependencies.ruma] -version = "0.1.0" -features = ["client-api-c", "compat", "unstable-pre-spec"] +instant = { version = "0.1.9", features = ["wasm-bindgen", "now"] } +ruma = { version = "0.1.2", features = ["client-api-c"] } +serde = "1.0.122" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] uuid = { version = "0.8.2", default-features = false, features = ["v4", "serde"] } @@ -29,7 +22,7 @@ uuid = { version = "0.8.2", default-features = false, features = ["v4", "serde"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio] version = "1.1.0" default-features = false -features = ["sync"] +features = ["rt", "sync"] [target.'cfg(target_arch = "wasm32")'.dependencies] futures = "0.3.12" diff --git a/matrix_sdk_common/src/deserialized_responses.rs b/matrix_sdk_common/src/deserialized_responses.rs index 0ed970a5..6ea98046 100644 --- a/matrix_sdk_common/src/deserialized_responses.rs +++ b/matrix_sdk_common/src/deserialized_responses.rs @@ -1,20 +1,11 @@ use std::{collections::BTreeMap, convert::TryFrom}; use ruma::{ - api::client::r0::sync::sync_events::{ - Ephemeral, InvitedRoom, Presence, RoomAccountData, State, ToDevice, - }, - serde::Raw, - DeviceIdBox, -}; -use serde::{Deserialize, Serialize}; - -use super::{ - api::r0::{ + api::client::r0::{ push::get_notifications::Notification, sync::sync_events::{ - DeviceLists, GlobalAccountData, - UnreadNotificationsCount as RumaUnreadNotificationsCount, + DeviceLists, Ephemeral, GlobalAccountData, InvitedRoom, Presence, RoomAccountData, + State, ToDevice, UnreadNotificationsCount as RumaUnreadNotificationsCount, }, }, events::{ @@ -22,8 +13,10 @@ use super::{ SyncStateEvent, Unsigned, }, identifiers::{DeviceKeyAlgorithm, EventId, RoomId, UserId}, - MilliSecondsSinceUnixEpoch, + serde::Raw, + DeviceIdBox, MilliSecondsSinceUnixEpoch, }; +use serde::{Deserialize, Serialize}; /// A change in ambiguity of room members that an `m.room.member` event /// triggers. @@ -258,7 +251,7 @@ pub struct MemberEvent { } impl TryFrom> for MemberEvent { - type Error = super::identifiers::Error; + type Error = ruma::identifiers::Error; fn try_from(event: SyncStateEvent) -> Result { Ok(MemberEvent { @@ -274,7 +267,7 @@ impl TryFrom> for MemberEvent { } impl TryFrom> for MemberEvent { - type Error = super::identifiers::Error; + type Error = ruma::identifiers::Error; fn try_from(event: StateEvent) -> Result { Ok(MemberEvent { @@ -315,7 +308,7 @@ pub struct StrippedMemberEvent { } impl TryFrom> for StrippedMemberEvent { - type Error = super::identifiers::Error; + type Error = ruma::identifiers::Error; fn try_from(event: StrippedStateEvent) -> Result { Ok(StrippedMemberEvent { diff --git a/matrix_sdk_common/src/lib.rs b/matrix_sdk_common/src/lib.rs index c45a082d..9fe8d7c1 100644 --- a/matrix_sdk_common/src/lib.rs +++ b/matrix_sdk_common/src/lib.rs @@ -1,22 +1,5 @@ pub use async_trait::async_trait; pub use instant; -#[cfg(feature = "appservice")] -pub use ruma::{ - api::{appservice as api_appservice, IncomingRequest, OutgoingRequestAppserviceExt}, - serde::{exports::serde::de::value::Error as SerdeError, urlencoded}, -}; -pub use ruma::{ - api::{ - client as api, - error::{ - FromHttpRequestError, FromHttpResponseError, IntoHttpError, MatrixError, ServerError, - }, - AuthScheme, EndpointError, IncomingResponse, OutgoingRequest, SendAccessToken, - }, - assign, directory, encryption, events, identifiers, int, presence, push, receipt, - serde::{CanonicalJsonValue, Raw}, - thirdparty, uint, Int, MilliSecondsSinceUnixEpoch, Outgoing, SecondsSinceUnixEpoch, UInt, -}; pub use uuid; pub mod deserialized_responses;