From 5cb5fdf499d12a3a5589c0b71d056f28d7699c40 Mon Sep 17 00:00:00 2001 From: Martell Malone Date: Wed, 27 Nov 2019 21:12:57 -0800 Subject: [PATCH] Update actix-codec to tokio 0.2 --- actix-codec/Cargo.toml | 8 ++++---- actix-codec/src/bcodec.rs | 4 ++-- actix-codec/src/framed.rs | 4 ++-- actix-codec/src/lib.rs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/actix-codec/Cargo.toml b/actix-codec/Cargo.toml index c9970269..34231dce 100644 --- a/actix-codec/Cargo.toml +++ b/actix-codec/Cargo.toml @@ -18,9 +18,9 @@ name = "actix_codec" path = "src/lib.rs" [dependencies] -bytes = "0.4.12" +bytes = "0.5" futures = "0.3.1" pin-project = "0.4.5" -tokio-io = "0.2.0-alpha.6" -tokio-codec = "0.2.0-alpha.6" -log = "0.4" \ No newline at end of file +tokio = { version = "0.2", features = ["io-std", "io-util"] } +tokio-util = { version = "0.2", features = ["codec"] } +log = "0.4" diff --git a/actix-codec/src/bcodec.rs b/actix-codec/src/bcodec.rs index d7523bf0..01e9387c 100644 --- a/actix-codec/src/bcodec.rs +++ b/actix-codec/src/bcodec.rs @@ -1,7 +1,7 @@ use std::io; use bytes::{Bytes, BytesMut}; -use tokio_codec::{Decoder, Encoder}; +use tokio_util::codec::{Decoder, Encoder}; /// Bytes codec. /// @@ -27,7 +27,7 @@ impl Decoder for BytesCodec { if src.is_empty() { Ok(None) } else { - Ok(Some(src.take())) + Ok(Some(src.split())) } } } diff --git a/actix-codec/src/framed.rs b/actix-codec/src/framed.rs index a8c388cd..b73ad636 100644 --- a/actix-codec/src/framed.rs +++ b/actix-codec/src/framed.rs @@ -8,8 +8,8 @@ use std::task::{Context, Poll}; use bytes::BytesMut; use futures::{ready, Sink, Stream}; use pin_project::pin_project; -use tokio_codec::{Decoder, Encoder}; -use tokio_io::{AsyncRead, AsyncWrite}; +use tokio_util::codec::{Decoder, Encoder}; +use tokio::io::{AsyncRead, AsyncWrite}; const LW: usize = 1024; const HW: usize = 8 * 1024; diff --git a/actix-codec/src/lib.rs b/actix-codec/src/lib.rs index 4ea33aef..5042ba97 100644 --- a/actix-codec/src/lib.rs +++ b/actix-codec/src/lib.rs @@ -16,5 +16,5 @@ mod framed; pub use self::bcodec::BytesCodec; pub use self::framed::{Framed, FramedParts}; -pub use tokio_codec::{Decoder, Encoder}; -pub use tokio_io::{AsyncRead, AsyncWrite}; +pub use tokio_util::codec::{Decoder, Encoder}; +pub use tokio::io::{AsyncRead, AsyncWrite};