From 1a3707649ee01204f05a14515ef72969eed659e4 Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 31 Jul 2018 23:34:04 +0200 Subject: [PATCH] use tokio-codec --- Cargo.toml | 1 + src/lib.rs | 1 + src/stream_start.rs | 2 +- src/xmpp_codec.rs | 4 ++-- src/xmpp_stream.rs | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 665167a..e9f2938 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ authors = ["Astro "] futures = "^0.1" tokio-core = "^0.1" tokio-io = "^0.1" +tokio-codec = "^0.1" bytes = "0.4.9" xml5ever = "*" tendril = "*" diff --git a/src/lib.rs b/src/lib.rs index 9401cc4..7c42c37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ extern crate futures; extern crate tokio_core; extern crate tokio_io; +extern crate tokio_codec; extern crate bytes; extern crate xml5ever; extern crate tendril; diff --git a/src/stream_start.rs b/src/stream_start.rs index 5dda29a..f7c3b79 100644 --- a/src/stream_start.rs +++ b/src/stream_start.rs @@ -2,7 +2,7 @@ use std::mem::replace; use std::io::{Error, ErrorKind}; use futures::{Future, Async, Poll, Stream, sink, Sink}; use tokio_io::{AsyncRead, AsyncWrite}; -use tokio_io::codec::Framed; +use tokio_codec::Framed; use jid::Jid; use minidom::Element; diff --git a/src/xmpp_codec.rs b/src/xmpp_codec.rs index 349b5ac..f38d845 100644 --- a/src/xmpp_codec.rs +++ b/src/xmpp_codec.rs @@ -8,7 +8,7 @@ use std::str::from_utf8; use std::io::{Error, ErrorKind}; use std::collections::HashMap; use std::collections::vec_deque::VecDeque; -use tokio_io::codec::{Encoder, Decoder}; +use tokio_codec::{Encoder, Decoder}; use minidom::Element; use xml5ever::tokenizer::{XmlTokenizer, TokenSink, Token, Tag, TagKind}; use xml5ever::interface::Attribute; @@ -430,7 +430,7 @@ mod tests { fn test_large_stanza() { use std::io::Cursor; use futures::{Future, Sink}; - use tokio_io::codec::FramedWrite; + use tokio_codec::FramedWrite; let framed = FramedWrite::new(Cursor::new(vec![]), XMPPCodec::new()); let mut text = "".to_owned(); for _ in 0..2usize.pow(15) { diff --git a/src/xmpp_stream.rs b/src/xmpp_stream.rs index 2b9c7ae..29f7d2e 100644 --- a/src/xmpp_stream.rs +++ b/src/xmpp_stream.rs @@ -1,6 +1,6 @@ use futures::{Poll, Stream, Sink, StartSend}; use tokio_io::{AsyncRead, AsyncWrite}; -use tokio_io::codec::Framed; +use tokio_codec::Framed; use minidom::Element; use jid::Jid; @@ -25,7 +25,7 @@ impl XMPPStream { } pub fn start(stream: S, jid: Jid, ns: String) -> StreamStart { - let xmpp_stream = AsyncRead::framed(stream, XMPPCodec::new()); + let xmpp_stream = Framed::new(stream, XMPPCodec::new()); StreamStart::from_stream(xmpp_stream, jid, ns) }