Move ruma-client examples to ruma crate to avoid circular dev-dependency

This commit is contained in:
Jonas Platte 2021-05-17 01:39:31 +02:00
parent 83939ab0eb
commit 224b4e7707
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
6 changed files with 19 additions and 24 deletions

View File

@ -50,19 +50,4 @@ serde = { version = "1.0.118", features = ["derive"] }
serde_json = "1.0.61" serde_json = "1.0.61"
[dev-dependencies] [dev-dependencies]
anyhow = "1.0.37" ruma-client-api = { version = "0.10.0", path = "../ruma-client-api", features = ["client"] }
ruma = { version = "0.0.3", path = "../ruma", features = ["client-api-c"] }
tokio = { version = "1.0.1", features = ["macros", "rt"] }
tokio-stream = { version = "0.1.1", default-features = false }
[[example]]
name = "hello_world"
required-features = ["client-api", "hyper-native-tls"]
[[example]]
name = "hello_isahc"
required-features = ["client-api", "isahc"]
[[example]]
name = "message_log"
required-features = ["client-api", "hyper-native-tls"]

View File

@ -56,10 +56,8 @@
//! # let client = MatrixClient::new(homeserver_url, None); //! # let client = MatrixClient::new(homeserver_url, None);
//! use std::convert::TryFrom; //! use std::convert::TryFrom;
//! //!
//! use ruma::{ //! use ruma_client_api::r0::alias::get_alias;
//! api::client::r0::alias::get_alias, //! use ruma_identifiers::{room_alias_id, room_id};
//! room_alias_id, room_id,
//! };
//! //!
//! async { //! async {
//! let response = client //! let response = client

View File

@ -36,7 +36,11 @@ ruma-identity-service-api = { version = "0.1.0", path = "../ruma-identity-servic
ruma-push-gateway-api = { version = "0.1.0", path = "../ruma-push-gateway-api", optional = true } ruma-push-gateway-api = { version = "0.1.0", path = "../ruma-push-gateway-api", optional = true }
[dev-dependencies] [dev-dependencies]
anyhow = "1.0.37"
isahc = "1.3.1"
serde = { version = "1.0.118", features = ["derive"] } serde = { version = "1.0.118", features = ["derive"] }
tokio = { version = "1.0.1", features = ["macros", "rt"] }
tokio-stream = { version = "0.1.1", default-features = false }
[features] [features]
api = ["ruma-api"] api = ["ruma-api"]
@ -134,3 +138,15 @@ unstable-pre-spec = [
#"ruma-identity-service-api/unstable-pre-spec", #"ruma-identity-service-api/unstable-pre-spec",
#"ruma-push-gateway-api/unstable-pre-spec", #"ruma-push-gateway-api/unstable-pre-spec",
] ]
[[example]]
name = "hello_world"
required-features = ["client-api-c", "client-ext-client-api", "client-hyper-native-tls"]
[[example]]
name = "hello_isahc"
required-features = ["client-api-c", "client-ext-client-api", "client-isahc"]
[[example]]
name = "message_log"
required-features = ["client-api-c", "client-ext-client-api", "client-hyper-native-tls"]

View File

@ -1,10 +1,6 @@
//! Same as the hello_world example, but using the isahc http client (a Rust wrapper around //! Same as the hello_world example, but using the isahc http client (a Rust wrapper around
//! libcurl). //! libcurl).
// "Undo" rename from `Cargo.toml` that only serves to make crate names available as a Cargo
// feature names.
extern crate isahc_crate as isahc;
use std::{convert::TryFrom, env, process::exit}; use std::{convert::TryFrom, env, process::exit};
use ruma::{ use ruma::{