From c0af5672589e890e2dcc37b447ea741465094b69 Mon Sep 17 00:00:00 2001 From: Aaron Weiss Date: Wed, 21 Jun 2017 22:14:15 -0400 Subject: [PATCH] Cleaned up imports and prelude. --- src/client/data/mod.rs | 25 ------------------------- src/client/mod.rs | 5 +++-- src/client/server/mod.rs | 5 +++-- src/client/server/utils.rs | 6 +++--- src/proto/command.rs | 2 +- src/proto/message.rs | 4 ++-- 6 files changed, 12 insertions(+), 35 deletions(-) diff --git a/src/client/data/mod.rs b/src/client/data/mod.rs index 3c9933c..8484550 100644 --- a/src/client/data/mod.rs +++ b/src/client/data/mod.rs @@ -1,32 +1,7 @@ //! Data related to IRC functionality. -pub use proto::caps::{Capability, NegotiationVersion}; -pub use proto::command::Command; pub use client::data::config::Config; -pub use proto::message::Message; -pub use proto::response::Response; pub use client::data::user::{AccessLevel, User}; -pub mod kinds { - //! Trait definitions of appropriate Writers and Buffers for use with this library. - use std::io::prelude::*; - - /// Trait describing all possible Writers for this library. - pub trait IrcWrite: Write + Sized + Send + 'static {} - impl IrcWrite for T - where - T: Write + Sized + Send + 'static, - { - } - - /// Trait describing all possible Readers for this library. - pub trait IrcRead: BufRead + Sized + Send + 'static {} - impl IrcRead for T - where - T: BufRead + Sized + Send + 'static, - { - } -} - pub mod config; pub mod user; diff --git a/src/client/mod.rs b/src/client/mod.rs index 5b953e1..ec0e686 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -7,9 +7,10 @@ pub mod transport; pub mod prelude { //! A client-side IRC prelude, re-exporting all the necessary basics. + pub use client::data::Config; pub use client::server::{IrcServer, Server}; pub use client::server::utils::ServerExt; - pub use client::data::{Capability, Command, Config, Message, NegotiationVersion, Response}; - pub use client::data::kinds::{IrcRead, IrcWrite}; + pub use proto::{Capability, Command, Message, NegotiationVersion, Response}; + pub use futures::{Future, Stream}; } diff --git a/src/client/server/mod.rs b/src/client/server/mod.rs index edf89d8..e2bfc25 100644 --- a/src/client/server/mod.rs +++ b/src/client/server/mod.rs @@ -5,10 +5,11 @@ use std::sync::{Arc, Mutex, RwLock}; use std::thread; use error; use client::conn::Connection; -use client::data::{Command, Config, Message, Response, User}; -use client::data::Command::{JOIN, NICK, NICKSERV, PART, PRIVMSG, MODE, QUIT}; +use client::data::{Config, User}; use client::server::utils::ServerExt; use client::transport::LogView; +use proto::{Command, Message, Response}; +use proto::Command::{JOIN, NICK, NICKSERV, PART, PRIVMSG, MODE, QUIT}; use futures::{Async, Poll, Future, Sink, Stream}; use futures::stream::SplitStream; use futures::sync::mpsc; diff --git a/src/client/server/utils.rs b/src/client/server/utils.rs index 8640e83..467b249 100644 --- a/src/client/server/utils.rs +++ b/src/client/server/utils.rs @@ -1,9 +1,9 @@ //! Utilities and shortcuts for working with IRC servers. use std::borrow::ToOwned; use error::Result; -use client::data::{Capability, NegotiationVersion}; -use client::data::Command::{AUTHENTICATE, CAP, INVITE, JOIN, KICK, KILL, MODE, NICK, NOTICE}; -use client::data::Command::{OPER, PART, PASS, PONG, PRIVMSG, QUIT, SAMODE, SANICK, TOPIC, USER}; +use proto::{Capability, NegotiationVersion}; +use proto::Command::{AUTHENTICATE, CAP, INVITE, JOIN, KICK, KILL, MODE, NICK, NOTICE}; +use proto::Command::{OPER, PART, PASS, PONG, PRIVMSG, QUIT, SAMODE, SANICK, TOPIC, USER}; use client::server::Server; use proto::command::CapSubCommand::{END, LS, REQ}; #[cfg(feature = "ctcp")] diff --git a/src/proto/command.rs b/src/proto/command.rs index 5379fa2..4ac17bb 100644 --- a/src/proto/command.rs +++ b/src/proto/command.rs @@ -1,7 +1,7 @@ //! Enumeration of all available client commands. use std::str::FromStr; use error; -use client::data::Response; +use proto::Response; /// List of all client commands as defined in [RFC 2812](http://tools.ietf.org/html/rfc2812). This /// also includes commands from the diff --git a/src/proto/message.rs b/src/proto/message.rs index f9aa5ad..b431c49 100644 --- a/src/proto/message.rs +++ b/src/proto/message.rs @@ -4,7 +4,7 @@ use std::fmt::{Display, Formatter, Result as FmtResult}; use std::str::FromStr; use error; use error::{Error, ErrorKind}; -use client::data::Command; +use proto::Command; /// IRC Message data. #[derive(Clone, PartialEq, Debug)] @@ -158,7 +158,7 @@ pub struct Tag(pub String, pub Option); #[cfg(test)] mod test { use super::{Message, Tag}; - use client::data::Command::{PRIVMSG, Raw}; + use proto::Command::{PRIVMSG, Raw}; #[test] fn new() {