Cleaned up imports and prelude.

This commit is contained in:
Aaron Weiss 2017-06-21 22:14:15 -04:00
parent 8c9a1aca2c
commit c0af567258
No known key found for this signature in database
GPG key ID: 0237035D9BF03AE2
6 changed files with 12 additions and 35 deletions

View file

@ -1,32 +1,7 @@
//! Data related to IRC functionality. //! Data related to IRC functionality.
pub use proto::caps::{Capability, NegotiationVersion};
pub use proto::command::Command;
pub use client::data::config::Config; pub use client::data::config::Config;
pub use proto::message::Message;
pub use proto::response::Response;
pub use client::data::user::{AccessLevel, User}; 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<T> 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<T> IrcRead for T
where
T: BufRead + Sized + Send + 'static,
{
}
}
pub mod config; pub mod config;
pub mod user; pub mod user;

View file

@ -7,9 +7,10 @@ pub mod transport;
pub mod prelude { pub mod prelude {
//! A client-side IRC prelude, re-exporting all the necessary basics. //! 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::{IrcServer, Server};
pub use client::server::utils::ServerExt; pub use client::server::utils::ServerExt;
pub use client::data::{Capability, Command, Config, Message, NegotiationVersion, Response}; pub use proto::{Capability, Command, Message, NegotiationVersion, Response};
pub use client::data::kinds::{IrcRead, IrcWrite};
pub use futures::{Future, Stream}; pub use futures::{Future, Stream};
} }

View file

@ -5,10 +5,11 @@ use std::sync::{Arc, Mutex, RwLock};
use std::thread; use std::thread;
use error; use error;
use client::conn::Connection; use client::conn::Connection;
use client::data::{Command, Config, Message, Response, User}; use client::data::{Config, User};
use client::data::Command::{JOIN, NICK, NICKSERV, PART, PRIVMSG, MODE, QUIT};
use client::server::utils::ServerExt; use client::server::utils::ServerExt;
use client::transport::LogView; 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::{Async, Poll, Future, Sink, Stream};
use futures::stream::SplitStream; use futures::stream::SplitStream;
use futures::sync::mpsc; use futures::sync::mpsc;

View file

@ -1,9 +1,9 @@
//! Utilities and shortcuts for working with IRC servers. //! Utilities and shortcuts for working with IRC servers.
use std::borrow::ToOwned; use std::borrow::ToOwned;
use error::Result; use error::Result;
use client::data::{Capability, NegotiationVersion}; use proto::{Capability, NegotiationVersion};
use client::data::Command::{AUTHENTICATE, CAP, INVITE, JOIN, KICK, KILL, MODE, NICK, NOTICE}; use proto::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::Command::{OPER, PART, PASS, PONG, PRIVMSG, QUIT, SAMODE, SANICK, TOPIC, USER};
use client::server::Server; use client::server::Server;
use proto::command::CapSubCommand::{END, LS, REQ}; use proto::command::CapSubCommand::{END, LS, REQ};
#[cfg(feature = "ctcp")] #[cfg(feature = "ctcp")]

View file

@ -1,7 +1,7 @@
//! Enumeration of all available client commands. //! Enumeration of all available client commands.
use std::str::FromStr; use std::str::FromStr;
use error; 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 /// List of all client commands as defined in [RFC 2812](http://tools.ietf.org/html/rfc2812). This
/// also includes commands from the /// also includes commands from the

View file

@ -4,7 +4,7 @@ use std::fmt::{Display, Formatter, Result as FmtResult};
use std::str::FromStr; use std::str::FromStr;
use error; use error;
use error::{Error, ErrorKind}; use error::{Error, ErrorKind};
use client::data::Command; use proto::Command;
/// IRC Message data. /// IRC Message data.
#[derive(Clone, PartialEq, Debug)] #[derive(Clone, PartialEq, Debug)]
@ -158,7 +158,7 @@ pub struct Tag(pub String, pub Option<String>);
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::{Message, Tag}; use super::{Message, Tag};
use client::data::Command::{PRIVMSG, Raw}; use proto::Command::{PRIVMSG, Raw};
#[test] #[test]
fn new() { fn new() {