Reexport independent external crates entirely

… instead of reexporting individual items.
master
Jonas Platte 2021-06-23 12:06:28 +02:00
parent b181125e6f
commit 4a7010bab1
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
21 changed files with 105 additions and 99 deletions

View File

@ -1,9 +1,9 @@
use std::{env, process::exit};
use matrix_sdk::{
self, async_trait,
events::{room::member::MemberEventContent, StrippedStateEvent},
async_trait,
room::Room,
ruma::events::{room::member::MemberEventContent, StrippedStateEvent},
Client, ClientConfig, EventHandler, SyncSettings,
};
use tokio::time::{sleep, Duration};

View File

@ -1,12 +1,12 @@
use std::{env, process::exit};
use matrix_sdk::{
self, async_trait,
events::{
async_trait,
room::Room,
ruma::events::{
room::message::{MessageEventContent, MessageType, TextMessageEventContent},
AnyMessageEventContent, SyncMessageEvent,
},
room::Room,
Client, ClientConfig, EventHandler, SyncSettings,
};
use url::Url;

View File

@ -6,7 +6,8 @@ use std::{
};
use matrix_sdk::{
self, api::r0::uiaa::AuthData, identifiers::UserId, Client, LoopCtrl, SyncSettings,
ruma::{api::client::r0::uiaa::AuthData, UserId},
Client, LoopCtrl, SyncSettings,
};
use serde_json::json;
use url::Url;

View File

@ -9,8 +9,12 @@ use std::{
use matrix_sdk::{
self,
events::{room::message::MessageType, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent},
identifiers::UserId,
ruma::{
events::{
room::message::MessageType, AnySyncMessageEvent, AnySyncRoomEvent, AnyToDeviceEvent,
},
UserId,
},
verification::{SasVerification, Verification},
Client, LoopCtrl, SyncSettings,
};

View File

@ -1,9 +1,7 @@
use std::{convert::TryFrom, env, process::exit};
use matrix_sdk::{
self,
api::r0::profile,
identifiers::{MxcUri, UserId},
ruma::{api::client::r0::profile, MxcUri, UserId},
Client, Result as MatrixResult,
};
use url::Url;

View File

@ -9,11 +9,11 @@ use std::{
use matrix_sdk::{
self, async_trait,
events::{
room::Room,
ruma::events::{
room::message::{MessageEventContent, MessageType, TextMessageEventContent},
SyncMessageEvent,
},
room::Room,
Client, EventHandler, SyncSettings,
};
use tokio::sync::Mutex;

View File

@ -2,11 +2,11 @@ use std::{env, process::exit};
use matrix_sdk::{
self, async_trait,
events::{
room::Room,
ruma::events::{
room::message::{MessageEventContent, MessageType, TextMessageEventContent},
SyncMessageEvent,
},
room::Room,
Client, EventHandler, SyncSettings,
};
use url::Url;

View File

@ -1,10 +1,12 @@
use matrix_sdk::{
deserialized_responses::SyncResponse,
ruma::{
events::{
room::message::{MessageEventContent, MessageType, TextMessageEventContent},
AnyMessageEventContent, AnySyncMessageEvent, AnySyncRoomEvent, SyncMessageEvent,
},
identifiers::RoomId,
RoomId,
},
Client, LoopCtrl, SyncSettings,
};
use url::Url;

View File

@ -571,7 +571,7 @@ impl Client {
/// # Example
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk::{Client, identifiers::UserId};
/// # use matrix_sdk::{Client, ruma::UserId};
/// # use futures::executor::block_on;
/// let alice = UserId::try_from("@alice:example.org").unwrap();
/// # block_on(async {
@ -792,7 +792,7 @@ impl Client {
/// ```no_run
/// # use futures::executor::block_on;
/// # use matrix_sdk::Client;
/// # use matrix_sdk::identifiers::room_id;
/// # use matrix_sdk::ruma::room_id;
/// # use matrix_sdk::media::MediaFormat;
/// # use url::Url;
/// # let homeserver = Url::parse("http://example.com").unwrap();
@ -1001,8 +1001,7 @@ impl Client {
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk::Client;
/// # use matrix_sdk::identifiers::DeviceId;
/// # use matrix_sdk::assign;
/// # use matrix_sdk::ruma::{assign, DeviceId};
/// # use futures::executor::block_on;
/// # use url::Url;
/// # let homeserver = Url::parse("http://example.com").unwrap();
@ -1260,8 +1259,7 @@ impl Client {
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk::Client;
/// # use matrix_sdk::identifiers::DeviceId;
/// # use matrix_sdk::assign;
/// # use matrix_sdk::ruma::{assign, DeviceId};
/// # use futures::executor::block_on;
/// # use url::Url;
/// # let homeserver = Url::parse("https://example.com").unwrap();
@ -1340,10 +1338,13 @@ impl Client {
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk::Client;
/// # use matrix_sdk::api::r0::account::register::{Request as RegistrationRequest, RegistrationKind};
/// # use matrix_sdk::api::r0::uiaa::AuthData;
/// # use matrix_sdk::identifiers::DeviceId;
/// # use matrix_sdk::assign;
/// # use matrix_sdk::ruma::{
/// # api::client::r0::{
/// # account::register::{Request as RegistrationRequest, RegistrationKind},
/// # uiaa::AuthData,
/// # },
/// # assign, DeviceId,
/// # };
/// # use futures::executor::block_on;
/// # use url::Url;
/// # let homeserver = Url::parse("http://example.com").unwrap();
@ -1393,7 +1394,7 @@ impl Client {
/// ```no_run
/// # use matrix_sdk::{
/// # Client, SyncSettings,
/// # api::r0::{
/// # ruma::api::client::r0::{
/// # filter::{
/// # FilterDefinition, LazyLoadOptions, RoomEventFilter, RoomFilter,
/// # },
@ -1537,7 +1538,10 @@ impl Client {
/// # Examples
/// ```no_run
/// use matrix_sdk::Client;
/// # use matrix_sdk::api::r0::room::{create_room::Request as CreateRoomRequest, Visibility};
/// # use matrix_sdk::ruma::api::client::r0::room::{
/// # create_room::Request as CreateRoomRequest,
/// # Visibility,
/// # };
/// # use url::Url;
///
/// # let homeserver = Url::parse("http://example.com").unwrap();
@ -1570,9 +1574,11 @@ impl Client {
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk::Client;
/// # use matrix_sdk::directory::{Filter, RoomNetwork};
/// # use matrix_sdk::api::r0::directory::get_public_rooms_filtered::Request as PublicRoomsFilterRequest;
/// # use matrix_sdk::assign;
/// # use matrix_sdk::ruma::{
/// # api::client::r0::directory::get_public_rooms_filtered::Request as PublicRoomsFilterRequest,
/// # directory::{Filter, RoomNetwork},
/// # assign,
/// # };
/// # use url::Url;
/// # use futures::executor::block_on;
/// # let homeserver = Url::parse("http://example.com").unwrap();
@ -1623,7 +1629,7 @@ impl Client {
///
/// ```no_run
/// # use std::{path::PathBuf, fs::File, io::Read};
/// # use matrix_sdk::{Client, identifiers::room_id};
/// # use matrix_sdk::{Client, ruma::room_id};
/// # use url::Url;
/// # use futures::executor::block_on;
/// # use mime;
@ -1690,9 +1696,9 @@ impl Client {
/// # use matrix_sdk::{Client, SyncSettings};
/// # use url::Url;
/// # use futures::executor::block_on;
/// # use matrix_sdk::identifiers::room_id;
/// # use matrix_sdk::ruma::room_id;
/// # use std::convert::TryFrom;
/// use matrix_sdk::events::{
/// use matrix_sdk::ruma::events::{
/// AnyMessageEventContent,
/// room::message::{MessageEventContent, TextMessageEventContent},
/// };
@ -1752,8 +1758,7 @@ impl Client {
/// # block_on(async {
/// # let homeserver = Url::parse("http://localhost:8080").unwrap();
/// # let mut client = Client::new(homeserver).unwrap();
/// use matrix_sdk::api::r0::profile;
/// use matrix_sdk::identifiers::user_id;
/// use matrix_sdk::ruma::{api::client::r0::profile, user_id};
///
/// // First construct the request you want to make
/// // See https://docs.rs/ruma-client-api/latest/ruma_client_api/index.html
@ -1839,8 +1844,11 @@ impl Client {
///
/// ```no_run
/// # use matrix_sdk::{
/// # api::r0::uiaa::{UiaaResponse, AuthData},
/// # Client, SyncSettings, Error, FromHttpResponseError, ServerError,
/// # ruma::api::{
/// # client::r0::uiaa::{UiaaResponse, AuthData},
/// # error::{FromHttpResponseError, ServerError},
/// # },
/// # Client, Error, SyncSettings,
/// # };
/// # use futures::executor::block_on;
/// # use serde_json::json;
@ -1959,7 +1967,7 @@ impl Client {
/// UI thread.
///
/// ```no_run
/// # use matrix_sdk::events::{
/// # use matrix_sdk::ruma::events::{
/// # room::message::{MessageEvent, MessageEventContent, TextMessageEventContent},
/// # };
/// # use std::sync::{Arc, RwLock};
@ -2228,7 +2236,7 @@ impl Client {
///
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk::{Client, identifiers::UserId};
/// # use matrix_sdk::{Client, ruma::UserId};
/// # use url::Url;
/// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap();
@ -2270,8 +2278,8 @@ impl Client {
/// # Examples
/// ```no_run
/// # use std::{convert::TryFrom, collections::BTreeMap};
/// # use matrix_sdk::{Client, identifiers::UserId};
/// # use matrix_sdk::api::r0::uiaa::AuthData;
/// # use matrix_sdk::{Client, ruma::UserId};
/// # use matrix_sdk::ruma::api::client::r0::uiaa::AuthData;
/// # use url::Url;
/// # use futures::executor::block_on;
/// # use serde_json::json;
@ -2341,7 +2349,7 @@ impl Client {
///
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk::{Client, identifiers::UserId};
/// # use matrix_sdk::{Client, ruma::UserId};
/// # use url::Url;
/// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap();
@ -2395,7 +2403,7 @@ impl Client {
/// # use std::{path::PathBuf, time::Duration};
/// # use matrix_sdk::{
/// # Client, SyncSettings,
/// # identifiers::room_id,
/// # ruma::room_id,
/// # };
/// # use futures::executor::block_on;
/// # use url::Url;
@ -2465,7 +2473,7 @@ impl Client {
/// # use std::{path::PathBuf, time::Duration};
/// # use matrix_sdk::{
/// # Client, SyncSettings,
/// # identifiers::room_id,
/// # ruma::room_id,
/// # };
/// # use futures::executor::block_on;
/// # use url::Url;

View File

@ -47,7 +47,7 @@ impl Device {
///
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk::{Client, identifiers::UserId};
/// # use matrix_sdk::{Client, ruma::UserId};
/// # use url::Url;
/// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap();

View File

@ -375,7 +375,7 @@ pub enum CustomEvent<'c> {
/// # use matrix_sdk::{
/// # async_trait,
/// # EventHandler,
/// # events::{
/// # ruma::events::{
/// # room::message::{MessageEventContent, MessageType, TextMessageEventContent},
/// # SyncMessageEvent
/// # },

View File

@ -18,6 +18,7 @@ use std::{convert::TryFrom, fmt::Debug, sync::Arc};
#[cfg(all(not(target_arch = "wasm32")))]
use backoff::{future::retry, Error as RetryError, ExponentialBackoff};
use bytes::{Bytes, BytesMut};
#[cfg(all(not(target_arch = "wasm32")))]
use http::StatusCode;
use http::{HeaderValue, Response as HttpResponse};
@ -30,7 +31,7 @@ use ruma::api::{
use tracing::trace;
use url::Url;
use crate::{error::HttpError, Bytes, BytesMut, ClientConfig, RequestConfig, Session};
use crate::{error::HttpError, ClientConfig, RequestConfig, Session};
/// Abstraction around the http layer. The allows implementors to use different
/// http libraries.
@ -54,7 +55,7 @@ pub trait HttpSend: AsyncTraitDeps {
///
/// ```
/// use std::convert::TryFrom;
/// use matrix_sdk::{HttpSend, async_trait, HttpError, RequestConfig, Bytes};
/// use matrix_sdk::{HttpSend, async_trait, HttpError, RequestConfig, bytes::Bytes};
///
/// #[derive(Debug)]
/// struct Client(reqwest::Client);

View File

@ -75,7 +75,7 @@ compile_error!("only one of 'native-tls' or 'rustls-tls' features can be enabled
#[cfg(all(feature = "sso_login", target_arch = "wasm32"))]
compile_error!("'sso_login' cannot be enabled on 'wasm32' arch");
pub use bytes::{Bytes, BytesMut};
pub use bytes;
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub use matrix_sdk_base::crypto::{EncryptionInfo, LocalTrust};
@ -85,23 +85,8 @@ 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,
};
#[doc(no_inline)]
pub use ruma;
mod client;
mod error;

View File

@ -79,7 +79,7 @@ impl Common {
/// ```no_run
/// # use futures::executor::block_on;
/// # use matrix_sdk::Client;
/// # use matrix_sdk::identifiers::room_id;
/// # use matrix_sdk::ruma::room_id;
/// # use matrix_sdk::media::MediaFormat;
/// # use url::Url;
/// # let homeserver = Url::parse("http://example.com").unwrap();
@ -118,9 +118,11 @@ impl Common {
/// ```no_run
/// # use std::convert::TryFrom;
/// use matrix_sdk::Client;
/// # use matrix_sdk::identifiers::room_id;
/// # use matrix_sdk::api::r0::filter::RoomEventFilter;
/// # use matrix_sdk::api::r0::message::get_message_events::Request as MessagesRequest;
/// # use matrix_sdk::ruma::room_id;
/// # use matrix_sdk::ruma::api::client::r0::{
/// # filter::RoomEventFilter,
/// # message::get_message_events::Request as MessagesRequest,
/// # };
/// # use url::Url;
///
/// # let homeserver = Url::parse("http://example.com").unwrap();

View File

@ -159,10 +159,10 @@ impl Joined {
///
/// ```no_run
/// use std::time::Duration;
/// use matrix_sdk::api::r0::typing::create_typing_event::Typing;
/// use matrix_sdk::ruma::api::client::r0::typing::create_typing_event::Typing;
/// # use matrix_sdk::{
/// # Client, SyncSettings,
/// # identifiers::room_id,
/// # ruma::room_id,
/// # };
/// # use futures::executor::block_on;
/// # use url::Url;
@ -349,9 +349,9 @@ impl Joined {
/// # use matrix_sdk::{Client, SyncSettings};
/// # use url::Url;
/// # use futures::executor::block_on;
/// # use matrix_sdk::identifiers::room_id;
/// # use matrix_sdk::ruma::room_id;
/// # use std::convert::TryFrom;
/// use matrix_sdk::events::{
/// use matrix_sdk::ruma::events::{
/// AnyMessageEventContent,
/// room::message::{MessageEventContent, TextMessageEventContent},
/// };
@ -431,7 +431,7 @@ impl Joined {
///
/// ```no_run
/// # use std::{path::PathBuf, fs::File, io::Read};
/// # use matrix_sdk::{Client, identifiers::room_id};
/// # use matrix_sdk::{Client, ruma::room_id};
/// # use url::Url;
/// # use mime;
/// # use futures::executor::block_on;
@ -532,18 +532,17 @@ impl Joined {
/// # Example
///
/// ```no_run
/// use matrix_sdk::{
/// use matrix_sdk::ruma::{
/// events::{
/// AnyStateEventContent,
/// room::member::{MemberEventContent, MembershipState},
/// },
/// identifiers::mxc_uri,
/// assign,
/// assign, mxc_uri,
/// };
/// # futures::executor::block_on(async {
/// # let homeserver = url::Url::parse("http://localhost:8080").unwrap();
/// # let mut client = matrix_sdk::Client::new(homeserver).unwrap();
/// # let room_id = matrix_sdk::identifiers::room_id!("!test:localhost");
/// # let room_id = matrix_sdk::ruma::room_id!("!test:localhost");
///
/// let avatar_url = mxc_uri!("mxc://example.org/avatar");
/// let member_event = assign!(MemberEventContent::new(MembershipState::Join), {
@ -591,11 +590,11 @@ impl Joined {
/// # futures::executor::block_on(async {
/// # let homeserver = url::Url::parse("http://localhost:8080").unwrap();
/// # let mut client = matrix_sdk::Client::new(homeserver).unwrap();
/// # let room_id = matrix_sdk::identifiers::room_id!("!test:localhost");
/// # let room_id = matrix_sdk::ruma::room_id!("!test:localhost");
/// # let room = client
/// # .get_joined_room(&room_id)
/// # .unwrap();
/// let event_id = matrix_sdk::identifiers::event_id!("$xxxxxx:example.org");
/// let event_id = matrix_sdk::ruma::event_id!("$xxxxxx:example.org");
/// let reason = Some("Indecent material");
/// room.redact(&event_id, reason, None).await.unwrap();
/// # })

View File

@ -39,7 +39,7 @@ impl RoomMember {
/// ```no_run
/// # use futures::executor::block_on;
/// # use matrix_sdk::Client;
/// # use matrix_sdk::identifiers::room_id;
/// # use matrix_sdk::ruma::room_id;
/// # use matrix_sdk::RoomMember;
/// # use matrix_sdk::media::MediaFormat;
/// # use url::Url;

View File

@ -45,7 +45,7 @@ impl SasVerification {
/// # use ruma::identifiers::user_id;
/// use matrix_sdk::verification::SasVerification;
/// use matrix_sdk_base::crypto::AcceptSettings;
/// use matrix_sdk::events::key::verification::ShortAuthenticationString;
/// use matrix_sdk::ruma::events::key::verification::ShortAuthenticationString;
/// # let homeserver = Url::parse("http://example.com").unwrap();
/// # let client = Client::new(homeserver).unwrap();
/// # let flow_id = "someID";

View File

@ -3,12 +3,14 @@ use std::{convert::TryFrom, env};
use matrix_sdk_appservice::{
matrix_sdk::{
async_trait,
room::Room,
ruma::{
events::{
room::member::{MemberEventContent, MembershipState},
SyncStateEvent,
},
identifiers::UserId,
room::Room,
UserId,
},
EventHandler,
},
AppService, AppServiceRegistration,

View File

@ -89,7 +89,9 @@ use dashmap::DashMap;
pub use error::Error;
use http::{uri::PathAndQuery, Uri};
pub use matrix_sdk;
use matrix_sdk::{reqwest::Url, Bytes, Client, ClientConfig, EventHandler, HttpError, Session};
use matrix_sdk::{
bytes::Bytes, reqwest::Url, Client, ClientConfig, EventHandler, HttpError, Session,
};
use regex::Regex;
#[doc(inline)]
pub use ruma::api::{appservice as api, appservice::Registration};

View File

@ -15,7 +15,7 @@
use std::{net::ToSocketAddrs, result::Result as StdResult};
use futures::TryFutureExt;
use matrix_sdk::Bytes;
use matrix_sdk::{bytes::Bytes, ruma};
use serde::Serialize;
use warp::{filters::BoxedFilter, path::FullPath, Filter, Rejection, Reply};
@ -110,7 +110,7 @@ mod filters {
.and(warp::query::raw())
.and_then(|token: String, query: String| async move {
let query: Vec<(String, String)> =
matrix_sdk::urlencoded::from_str(&query).map_err(Error::from)?;
ruma::serde::urlencoded::from_str(&query).map_err(Error::from)?;
if query.into_iter().any(|(key, value)| key == "access_token" && value == token) {
Ok::<(), Rejection>(())
@ -175,8 +175,8 @@ mod handlers {
appservice: AppService,
request: http::Request<Bytes>,
) -> StdResult<impl warp::Reply, Rejection> {
let incoming_transaction: matrix_sdk::api_appservice::event::push_events::v1::IncomingRequest =
matrix_sdk::IncomingRequest::try_from_http_request(request).map_err(Error::from)?;
let incoming_transaction: ruma::api::appservice::event::push_events::v1::IncomingRequest =
ruma::api::IncomingRequest::try_from_http_request(request).map_err(Error::from)?;
let client = appservice.get_cached_client(None)?;
client.receive_transaction(incoming_transaction).map_err(Error::from).await?;

View File

@ -3,10 +3,12 @@ use std::sync::{Arc, Mutex};
#[cfg(feature = "actix")]
use actix_web::{test as actix_test, App as ActixApp, HttpResponse};
use matrix_sdk::{
api_appservice::Registration,
async_trait,
events::{room::member::MemberEventContent, SyncStateEvent},
room::Room,
ruma::{
api::appservice::Registration,
events::{room::member::MemberEventContent, SyncStateEvent},
},
ClientConfig, EventHandler, RequestConfig,
};
use matrix_sdk_appservice::*;