Update to Rust 2018
This commit is contained in:
parent
f3e82e8c90
commit
28d7db40ed
@ -2,6 +2,7 @@
|
|||||||
authors = ["Jimmy Cuadra <jimmy@jimmycuadra.com>"]
|
authors = ["Jimmy Cuadra <jimmy@jimmycuadra.com>"]
|
||||||
description = "A Matrix client library."
|
description = "A Matrix client library."
|
||||||
documentation = "https://docs.rs/ruma-client"
|
documentation = "https://docs.rs/ruma-client"
|
||||||
|
edition = "2018"
|
||||||
homepage = "https://github.com/ruma/ruma-client"
|
homepage = "https://github.com/ruma/ruma-client"
|
||||||
keywords = ["matrix", "chat", "messaging", "ruma"]
|
keywords = ["matrix", "chat", "messaging", "ruma"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -1,16 +1,9 @@
|
|||||||
#![feature(try_from)]
|
#![feature(try_from)]
|
||||||
|
|
||||||
extern crate futures;
|
|
||||||
extern crate ruma_client;
|
|
||||||
extern crate ruma_events;
|
|
||||||
extern crate ruma_identifiers;
|
|
||||||
extern crate tokio_core;
|
|
||||||
extern crate url;
|
|
||||||
|
|
||||||
use std::{convert::TryFrom, env, process::exit};
|
use std::{convert::TryFrom, env, process::exit};
|
||||||
|
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
use ruma_client::{api::r0, Client};
|
use ruma_client::{self, api::r0, Client};
|
||||||
use ruma_events::{
|
use ruma_events::{
|
||||||
room::message::{MessageEventContent, MessageType, TextMessageEventContent},
|
room::message::{MessageEventContent, MessageType, TextMessageEventContent},
|
||||||
EventType,
|
EventType,
|
||||||
|
@ -29,7 +29,7 @@ macro_rules! endpoint {
|
|||||||
$($import),*
|
$($import),*
|
||||||
};
|
};
|
||||||
|
|
||||||
use {Client, Error};
|
use crate::{Client, Error};
|
||||||
|
|
||||||
/// Make a request to this API endpoint.
|
/// Make a request to this API endpoint.
|
||||||
pub fn call<C>(
|
pub fn call<C>(
|
||||||
|
25
src/lib.rs
25
src/lib.rs
@ -4,20 +4,6 @@
|
|||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![feature(try_from)]
|
#![feature(try_from)]
|
||||||
|
|
||||||
extern crate futures;
|
|
||||||
extern crate http;
|
|
||||||
extern crate hyper;
|
|
||||||
#[cfg(feature = "tls")]
|
|
||||||
extern crate hyper_tls;
|
|
||||||
#[cfg(feature = "tls")]
|
|
||||||
extern crate native_tls;
|
|
||||||
extern crate ruma_api;
|
|
||||||
extern crate ruma_client_api;
|
|
||||||
extern crate ruma_identifiers;
|
|
||||||
extern crate serde_json;
|
|
||||||
extern crate serde_urlencoded;
|
|
||||||
extern crate url;
|
|
||||||
|
|
||||||
use std::{cell::RefCell, convert::TryInto, rc::Rc, str::FromStr};
|
use std::{cell::RefCell, convert::TryInto, rc::Rc, str::FromStr};
|
||||||
|
|
||||||
use futures::{
|
use futures::{
|
||||||
@ -35,8 +21,7 @@ use native_tls::Error as NativeTlsError;
|
|||||||
use ruma_api::Endpoint;
|
use ruma_api::Endpoint;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
pub use error::Error;
|
pub use crate::{error::Error, session::Session};
|
||||||
pub use session::Session;
|
|
||||||
|
|
||||||
/// Matrix client-server API endpoints.
|
/// Matrix client-server API endpoints.
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -113,7 +98,7 @@ where
|
|||||||
password: String,
|
password: String,
|
||||||
device_id: Option<String>,
|
device_id: Option<String>,
|
||||||
) -> impl Future<Item = Session, Error = Error> {
|
) -> impl Future<Item = Session, Error = Error> {
|
||||||
use api::r0::session::login;
|
use crate::api::r0::session::login;
|
||||||
|
|
||||||
let data = self.0.clone();
|
let data = self.0.clone();
|
||||||
|
|
||||||
@ -140,7 +125,7 @@ where
|
|||||||
/// this method stores the session data returned by the endpoint in this
|
/// this method stores the session data returned by the endpoint in this
|
||||||
/// client, instead of returning it.
|
/// client, instead of returning it.
|
||||||
pub fn register_guest(&self) -> impl Future<Item = Session, Error = Error> {
|
pub fn register_guest(&self) -> impl Future<Item = Session, Error = Error> {
|
||||||
use api::r0::account::register;
|
use crate::api::r0::account::register;
|
||||||
|
|
||||||
let data = self.0.clone();
|
let data = self.0.clone();
|
||||||
|
|
||||||
@ -177,7 +162,7 @@ where
|
|||||||
username: Option<String>,
|
username: Option<String>,
|
||||||
password: String,
|
password: String,
|
||||||
) -> impl Future<Item = Session, Error = Error> {
|
) -> impl Future<Item = Session, Error = Error> {
|
||||||
use api::r0::account::register;
|
use crate::api::r0::account::register;
|
||||||
|
|
||||||
let data = self.0.clone();
|
let data = self.0.clone();
|
||||||
|
|
||||||
@ -212,7 +197,7 @@ where
|
|||||||
since: Option<String>,
|
since: Option<String>,
|
||||||
set_presence: bool,
|
set_presence: bool,
|
||||||
) -> impl Stream<Item = api::r0::sync::sync_events::Response, Error = Error> {
|
) -> impl Stream<Item = api::r0::sync::sync_events::Response, Error = Error> {
|
||||||
use api::r0::sync::sync_events;
|
use crate::api::r0::sync::sync_events;
|
||||||
|
|
||||||
let client = self.clone();
|
let client = self.clone();
|
||||||
let set_presence = if set_presence {
|
let set_presence = if set_presence {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user