From a6303d485853d2fc1994c5038079d18252094222 Mon Sep 17 00:00:00 2001 From: Aaron Weiss Date: Sun, 15 Jan 2017 17:02:37 -0500 Subject: [PATCH] Removed dependence on tokio-proto. --- Cargo.toml | 1 - src/lib.rs | 1 - src/proto/irc.rs | 41 ++--------------------------------------- 3 files changed, 2 insertions(+), 41 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 987ee96..622061d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,5 +21,4 @@ rustc-serialize = "0.3.0" time = "0.1.0" encoding = "0.2.0" tokio-core = "0.1.3" -tokio-proto = "0.1.0" tokio-service = "0.1.0" diff --git a/src/lib.rs b/src/lib.rs index 91830fb..b236a53 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,6 @@ extern crate time; extern crate encoding; extern crate rustc_serialize; extern crate tokio_core; -extern crate tokio_proto; extern crate tokio_service; pub mod client; diff --git a/src/proto/irc.rs b/src/proto/irc.rs index 040f15e..c9286f0 100644 --- a/src/proto/irc.rs +++ b/src/proto/irc.rs @@ -1,10 +1,9 @@ -//! Implementation of IRC protocol for Tokio. +//! Implementation of IRC codec for Tokio. use std::io; use proto::line::LineCodec; use proto::message::Message; -use tokio_core::io::{Codec, EasyBuf, Framed, Io}; -use tokio_proto::pipeline::{ServerProto, ClientProto}; +use tokio_core::io::{Codec, EasyBuf}; /// An IRC codec built around an inner codec. pub struct IrcCodec { @@ -41,39 +40,3 @@ impl Codec for IrcCodec where C: Codec { self.inner.encode(msg.to_string(), buf) } } - -/// Implementation of the IRC protocol backed by a line-delimited codec. -pub struct IrcProto { - encoding_label: String, -} - -impl IrcProto { - /// Creates a new IrcProto using the specified WHATWG encoding label. - fn new(label: &str) -> IrcProto { - IrcProto { encoding_label: label.to_owned() } - } -} - -impl ClientProto for IrcProto where T: Io + 'static { - type Request = Message; - type Response = Message; - - type Transport = Framed>; - type BindTransport = Result; - - fn bind_transport(&self, io: T) -> Self::BindTransport { - Ok(io.framed(try!(IrcCodec::new(&self.encoding_label)))) - } -} - -impl ServerProto for IrcProto where T: Io + 'static { - type Request = Message; - type Response = Message; - - type Transport = Framed>; - type BindTransport = Result; - - fn bind_transport(&self, io: T) -> Self::BindTransport { - Ok(io.framed(try!(IrcCodec::new(&self.encoding_label)))) - } -}