From 6cbdbdcd2f7666152ad2703015f3d9fd018ee91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 7 May 2020 08:51:59 +0200 Subject: [PATCH] matrix-sdk: Rename the types subproject to matrix-sdk-common. --- Cargo.toml | 2 +- matrix_sdk/Cargo.toml | 2 +- matrix_sdk/src/lib.rs | 2 +- {matrix_sdk_types => matrix_sdk_common}/Cargo.toml | 4 ++-- {matrix_sdk_types => matrix_sdk_common}/src/lib.rs | 0 matrix_sdk_crypto/Cargo.toml | 2 +- matrix_sdk_crypto/src/device.rs | 10 +++++----- matrix_sdk_crypto/src/machine.rs | 14 +++++++------- matrix_sdk_crypto/src/memory_stores.rs | 4 ++-- matrix_sdk_crypto/src/olm.rs | 8 ++++---- matrix_sdk_crypto/src/store/memorystore.rs | 4 ++-- matrix_sdk_crypto/src/store/mod.rs | 2 +- matrix_sdk_crypto/src/store/sqlite.rs | 8 ++++---- 13 files changed, 31 insertions(+), 31 deletions(-) rename {matrix_sdk_types => matrix_sdk_common}/Cargo.toml (83%) rename {matrix_sdk_types => matrix_sdk_common}/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 44af39f9..9bc413a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,5 +2,5 @@ members = [ "matrix_sdk", "matrix_sdk_crypto", - "matrix_sdk_types", + "matrix_sdk_common", ] diff --git a/matrix_sdk/Cargo.toml b/matrix_sdk/Cargo.toml index 36e08cfa..9cf6b6e3 100644 --- a/matrix_sdk/Cargo.toml +++ b/matrix_sdk/Cargo.toml @@ -26,7 +26,7 @@ serde = "1.0.106" serde_json = "1.0.52" uuid = { version = "0.8.1", features = ["v4"] } -matrix-sdk-types = { path = "../matrix_sdk_types" } +matrix-sdk-common = { path = "../matrix_sdk_common" } matrix-sdk-crypto = { path = "../matrix_sdk_crypto", optional = true } # Misc dependencies diff --git a/matrix_sdk/src/lib.rs b/matrix_sdk/src/lib.rs index 8999e450..a841bfd6 100644 --- a/matrix_sdk/src/lib.rs +++ b/matrix_sdk/src/lib.rs @@ -27,7 +27,7 @@ #![deny(missing_docs)] pub use crate::{error::Error, error::Result, session::Session}; -pub use matrix_sdk_types::*; +pub use matrix_sdk_common::*; pub use reqwest::header::InvalidHeaderValue; mod async_client; diff --git a/matrix_sdk_types/Cargo.toml b/matrix_sdk_common/Cargo.toml similarity index 83% rename from matrix_sdk_types/Cargo.toml rename to matrix_sdk_common/Cargo.toml index 9f3e192f..4dcfbb16 100644 --- a/matrix_sdk_types/Cargo.toml +++ b/matrix_sdk_common/Cargo.toml @@ -1,11 +1,11 @@ [package] authors = ["Damir Jelić DeviceKeys { let user_id = UserId::try_from("@alice:example.org").unwrap(); diff --git a/matrix_sdk_crypto/src/machine.rs b/matrix_sdk_crypto/src/machine.rs index c3e63c60..2c4dcd48 100644 --- a/matrix_sdk_crypto/src/machine.rs +++ b/matrix_sdk_crypto/src/machine.rs @@ -31,8 +31,8 @@ use super::store::memorystore::MemoryStore; use super::store::sqlite::SqliteStore; use super::{device::Device, store::Result as StoreError, CryptoStore}; -use matrix_sdk_types::api; -use matrix_sdk_types::events::{ +use matrix_sdk_common::api; +use matrix_sdk_common::events::{ collections::all::RoomEvent, room::encrypted::{ CiphertextInfo, EncryptedEvent, EncryptedEventContent, MegolmV1AesSha2Content, @@ -45,7 +45,7 @@ use matrix_sdk_types::events::{ }, Algorithm, EventJson, EventType, }; -use matrix_sdk_types::identifiers::{DeviceId, RoomId, UserId}; +use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId}; use api::r0::keys; use api::r0::{ @@ -1550,7 +1550,7 @@ mod test { static USER_ID: &str = "@bob:example.org"; static DEVICE_ID: &str = "DEVICEID"; - use matrix_sdk_types::js_int::UInt; + use matrix_sdk_common::js_int::UInt; use std::collections::BTreeMap; use std::convert::TryFrom; use std::fs::File; @@ -1564,10 +1564,10 @@ mod test { use crate::machine::{OlmMachine, OneTimeKeys}; use crate::Device; - use matrix_sdk_types::api::r0::{ + use matrix_sdk_common::api::r0::{ keys, to_device::send_event_to_device::Request as ToDeviceRequest, }; - use matrix_sdk_types::events::{ + use matrix_sdk_common::events::{ collections::all::RoomEvent, room::{ encrypted::{EncryptedEvent, EncryptedEventContent}, @@ -1576,7 +1576,7 @@ mod test { to_device::{AnyToDeviceEvent, ToDeviceEncrypted}, EventJson, EventType, UnsignedData, }; - use matrix_sdk_types::identifiers::{DeviceId, EventId, RoomId, UserId}; + use matrix_sdk_common::identifiers::{DeviceId, EventId, RoomId, UserId}; fn alice_id() -> UserId { UserId::try_from("@alice:example.org").unwrap() diff --git a/matrix_sdk_crypto/src/memory_stores.rs b/matrix_sdk_crypto/src/memory_stores.rs index 2dd20511..0735de30 100644 --- a/matrix_sdk_crypto/src/memory_stores.rs +++ b/matrix_sdk_crypto/src/memory_stores.rs @@ -20,7 +20,7 @@ use tokio::sync::Mutex; use super::device::Device; use super::olm::{InboundGroupSession, Session}; -use matrix_sdk_types::identifiers::{DeviceId, RoomId, UserId}; +use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId}; /// In-memory store for Olm Sessions. #[derive(Debug, Default)] @@ -215,7 +215,7 @@ mod test { use crate::memory_stores::{DeviceStore, GroupSessionStore, SessionStore}; use crate::olm::test::get_account_and_session; use crate::olm::{InboundGroupSession, OutboundGroupSession}; - use matrix_sdk_types::identifiers::RoomId; + use matrix_sdk_common::identifiers::RoomId; #[tokio::test] async fn test_session_store() { diff --git a/matrix_sdk_crypto/src/olm.rs b/matrix_sdk_crypto/src/olm.rs index c6294177..4df9741f 100644 --- a/matrix_sdk_crypto/src/olm.rs +++ b/matrix_sdk_crypto/src/olm.rs @@ -35,8 +35,8 @@ pub use olm_rs::{ utility::OlmUtility, }; -use matrix_sdk_types::api::r0::keys::SignedKey; -use matrix_sdk_types::identifiers::RoomId; +use matrix_sdk_common::api::r0::keys::SignedKey; +use matrix_sdk_common::identifiers::RoomId; /// Account holding identity keys for which sessions can be created. /// @@ -627,8 +627,8 @@ impl std::fmt::Debug for OutboundGroupSession { #[cfg(test)] pub(crate) mod test { use crate::olm::{Account, InboundGroupSession, OutboundGroupSession, Session}; - use matrix_sdk_types::api::r0::keys::SignedKey; - use matrix_sdk_types::identifiers::RoomId; + use matrix_sdk_common::api::r0::keys::SignedKey; + use matrix_sdk_common::identifiers::RoomId; use olm_rs::session::OlmMessage; use std::collections::BTreeMap; use std::convert::TryFrom; diff --git a/matrix_sdk_crypto/src/store/memorystore.rs b/matrix_sdk_crypto/src/store/memorystore.rs index 3cd422c9..0a921b85 100644 --- a/matrix_sdk_crypto/src/store/memorystore.rs +++ b/matrix_sdk_crypto/src/store/memorystore.rs @@ -21,7 +21,7 @@ use tokio::sync::Mutex; use super::{Account, CryptoStore, InboundGroupSession, Result, Session}; use crate::device::Device; use crate::memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices}; -use matrix_sdk_types::identifiers::{DeviceId, RoomId, UserId}; +use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId}; #[derive(Debug)] pub struct MemoryStore { @@ -119,7 +119,7 @@ mod test { use crate::olm::{InboundGroupSession, OutboundGroupSession}; use crate::store::memorystore::MemoryStore; use crate::store::CryptoStore; - use matrix_sdk_types::identifiers::RoomId; + use matrix_sdk_common::identifiers::RoomId; #[tokio::test] async fn test_session_store() { diff --git a/matrix_sdk_crypto/src/store/mod.rs b/matrix_sdk_crypto/src/store/mod.rs index 8d2a7655..36d6c4e4 100644 --- a/matrix_sdk_crypto/src/store/mod.rs +++ b/matrix_sdk_crypto/src/store/mod.rs @@ -26,7 +26,7 @@ use tokio::sync::Mutex; use super::device::Device; use super::memory_stores::UserDevices; use super::olm::{Account, InboundGroupSession, Session}; -use matrix_sdk_types::identifiers::{DeviceId, RoomId, UserId}; +use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId}; use olm_rs::errors::{OlmAccountError, OlmGroupSessionError, OlmSessionError}; pub mod memorystore; diff --git a/matrix_sdk_crypto/src/store/sqlite.rs b/matrix_sdk_crypto/src/store/sqlite.rs index b7d6fc9a..9d824032 100644 --- a/matrix_sdk_crypto/src/store/sqlite.rs +++ b/matrix_sdk_crypto/src/store/sqlite.rs @@ -30,9 +30,9 @@ use zeroize::Zeroizing; use super::{Account, CryptoStore, CryptoStoreError, InboundGroupSession, Result, Session}; use crate::device::{Device, TrustState}; use crate::memory_stores::{DeviceStore, GroupSessionStore, SessionStore, UserDevices}; -use matrix_sdk_types::api::r0::keys::KeyAlgorithm; -use matrix_sdk_types::events::Algorithm; -use matrix_sdk_types::identifiers::{DeviceId, RoomId, UserId}; +use matrix_sdk_common::api::r0::keys::KeyAlgorithm; +use matrix_sdk_common::events::Algorithm; +use matrix_sdk_common::identifiers::{DeviceId, RoomId, UserId}; /// SQLite based implementation of a `CryptoStore`. pub struct SqliteStore { @@ -694,7 +694,7 @@ impl std::fmt::Debug for SqliteStore { mod test { use crate::device::test::get_device; use crate::olm::GroupSessionKey; - use matrix_sdk_types::api::r0::keys::SignedKey; + use matrix_sdk_common::api::r0::keys::SignedKey; use olm_rs::outbound_group_session::OlmOutboundGroupSession; use std::collections::BTreeMap; use tempfile::tempdir;