From e50be58fdb1143dbf3d9d0dfbb85a912c181bc6c Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 9 Dec 2018 15:19:25 -0800 Subject: [PATCH] move codec to separate crate --- Cargo.toml | 2 ++ actix-codec/CHANGES.md | 5 ++++ actix-codec/Cargo.toml | 25 +++++++++++++++++++ {src/codec => actix-codec/src}/bcodec.rs | 0 {src/codec => actix-codec/src}/framed.rs | 0 {src/codec => actix-codec/src}/framed2.rs | 0 {src/codec => actix-codec/src}/framed_read.rs | 0 .../codec => actix-codec/src}/framed_write.rs | 0 src/codec/mod.rs => actix-codec/src/lib.rs | 5 +++- src/framed.rs | 3 +-- src/lib.rs | 1 - 11 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 actix-codec/CHANGES.md create mode 100644 actix-codec/Cargo.toml rename {src/codec => actix-codec/src}/bcodec.rs (100%) rename {src/codec => actix-codec/src}/framed.rs (100%) rename {src/codec => actix-codec/src}/framed2.rs (100%) rename {src/codec => actix-codec/src}/framed_read.rs (100%) rename {src/codec => actix-codec/src}/framed_write.rs (100%) rename src/codec/mod.rs => actix-codec/src/lib.rs (80%) diff --git a/Cargo.toml b/Cargo.toml index 0981dafc..fc7e452c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ edition = "2018" [workspace] members = [ "./", + "actix-codec", "actix-service", ] @@ -48,6 +49,7 @@ cell = [] [dependencies] actix = "0.7.6" actix-service = "0.1.1" +actix-codec = { path = "actix-codec" } log = "0.4" num_cpus = "1.0" diff --git a/actix-codec/CHANGES.md b/actix-codec/CHANGES.md new file mode 100644 index 00000000..aefde3cd --- /dev/null +++ b/actix-codec/CHANGES.md @@ -0,0 +1,5 @@ +# Changes + +## [0.1.0] - 2018-12-09 + +* Move codec to separate crate diff --git a/actix-codec/Cargo.toml b/actix-codec/Cargo.toml new file mode 100644 index 00000000..104527f0 --- /dev/null +++ b/actix-codec/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "actix-codec" +version = "0.1.0" +authors = ["Nikolay Kim "] +description = "Utilities for encoding and decoding frames" +keywords = ["network", "framework", "async", "futures"] +homepage = "https://actix.rs" +repository = "https://github.com/actix/actix-net.git" +documentation = "https://docs.rs/actix-codec/" +categories = ["network-programming", "asynchronous"] +license = "MIT/Apache-2.0" +exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"] +edition = "2018" +workspace = "../" + +[lib] +name = "actix_codec" +path = "src/lib.rs" + +[dependencies] +bytes = "0.4" +futures = "0.1.24" +tokio-io = "0.1" +tokio-codec = "0.1" +log = "0.4" \ No newline at end of file diff --git a/src/codec/bcodec.rs b/actix-codec/src/bcodec.rs similarity index 100% rename from src/codec/bcodec.rs rename to actix-codec/src/bcodec.rs diff --git a/src/codec/framed.rs b/actix-codec/src/framed.rs similarity index 100% rename from src/codec/framed.rs rename to actix-codec/src/framed.rs diff --git a/src/codec/framed2.rs b/actix-codec/src/framed2.rs similarity index 100% rename from src/codec/framed2.rs rename to actix-codec/src/framed2.rs diff --git a/src/codec/framed_read.rs b/actix-codec/src/framed_read.rs similarity index 100% rename from src/codec/framed_read.rs rename to actix-codec/src/framed_read.rs diff --git a/src/codec/framed_write.rs b/actix-codec/src/framed_write.rs similarity index 100% rename from src/codec/framed_write.rs rename to actix-codec/src/framed_write.rs diff --git a/src/codec/mod.rs b/actix-codec/src/lib.rs similarity index 80% rename from src/codec/mod.rs rename to actix-codec/src/lib.rs index 7674cdf5..c1ec4cde 100644 --- a/src/codec/mod.rs +++ b/actix-codec/src/lib.rs @@ -10,7 +10,7 @@ //! [`Stream`]: # //! [transports]: # -#![deny(missing_docs, missing_debug_implementations, warnings)] +// #![deny(missing_docs, missing_debug_implementations, warnings)] mod bcodec; mod framed; @@ -23,3 +23,6 @@ pub use self::framed::{Framed, FramedParts}; // pub use self::framed2::{Framed2, FramedParts2}; pub use self::framed_read::FramedRead; pub use self::framed_write::FramedWrite; + +pub use tokio_codec::{Decoder, Encoder}; +pub use tokio_io::{AsyncRead, AsyncWrite}; diff --git a/src/framed.rs b/src/framed.rs index e6548920..c1385ddd 100644 --- a/src/framed.rs +++ b/src/framed.rs @@ -3,6 +3,7 @@ use std::marker::PhantomData; use std::mem; use actix; +use actix_codec::Framed; use actix_service::{IntoNewService, IntoService, NewService, Service}; use futures::future::{ok, FutureResult}; use futures::unsync::mpsc; @@ -10,8 +11,6 @@ use futures::{Async, AsyncSink, Future, Poll, Sink, Stream}; use tokio_codec::{Decoder, Encoder}; use tokio_io::{AsyncRead, AsyncWrite}; -use crate::codec::Framed; - type Request = ::Item; type Response = ::Item; diff --git a/src/lib.rs b/src/lib.rs index 7e99b8af..fa0fe04f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,6 @@ mod cell; pub mod cloneable; -pub mod codec; pub mod connector; pub mod counter; pub mod either;