Reorganized imports into a consistent style.
This commit is contained in:
parent
eecbe1630c
commit
ec8fdeb2e9
10 changed files with 44 additions and 25 deletions
|
@ -2,10 +2,7 @@
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::{fmt, io};
|
use std::{fmt, io};
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use error;
|
|
||||||
use client::data::Config;
|
|
||||||
use client::transport::{IrcTransport, LogView, Logged};
|
|
||||||
use proto::{IrcCodec, Message};
|
|
||||||
use encoding::EncoderTrap;
|
use encoding::EncoderTrap;
|
||||||
use encoding::label::encoding_from_whatwg_label;
|
use encoding::label::encoding_from_whatwg_label;
|
||||||
use futures::{Async, Poll, Future, Sink, StartSend, Stream};
|
use futures::{Async, Poll, Future, Sink, StartSend, Stream};
|
||||||
|
@ -16,6 +13,11 @@ use tokio_io::AsyncRead;
|
||||||
use tokio_mockstream::MockStream;
|
use tokio_mockstream::MockStream;
|
||||||
use tokio_tls::{TlsConnectorExt, TlsStream};
|
use tokio_tls::{TlsConnectorExt, TlsStream};
|
||||||
|
|
||||||
|
use error;
|
||||||
|
use client::data::Config;
|
||||||
|
use client::transport::{IrcTransport, LogView, Logged};
|
||||||
|
use proto::{IrcCodec, Message};
|
||||||
|
|
||||||
/// An IRC connection used internally by `IrcServer`.
|
/// An IRC connection used internally by `IrcServer`.
|
||||||
pub enum Connection {
|
pub enum Connection {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
|
|
@ -6,7 +6,9 @@ use std::io::prelude::*;
|
||||||
use std::io::{Error, ErrorKind};
|
use std::io::{Error, ErrorKind};
|
||||||
use std::net::{SocketAddr, ToSocketAddrs};
|
use std::net::{SocketAddr, ToSocketAddrs};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
|
||||||
use error::Result;
|
use error::Result;
|
||||||
|
|
||||||
/// Configuration data.
|
/// Configuration data.
|
||||||
|
@ -285,11 +287,12 @@ impl Config {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::Config;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
use super::Config;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn load() {
|
fn load() {
|
||||||
let cfg = Config {
|
let cfg = Config {
|
||||||
|
|
|
@ -3,6 +3,7 @@ use std::borrow::ToOwned;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::cmp::Ordering::{Less, Equal, Greater};
|
use std::cmp::Ordering::{Less, Equal, Greater};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use proto::{Mode, ChannelMode};
|
use proto::{Mode, ChannelMode};
|
||||||
|
|
||||||
/// IRC User data.
|
/// IRC User data.
|
||||||
|
@ -226,8 +227,8 @@ impl Iterator for AccessLevelIterator {
|
||||||
mod test {
|
mod test {
|
||||||
use super::{AccessLevel, User};
|
use super::{AccessLevel, User};
|
||||||
use super::AccessLevel::*;
|
use super::AccessLevel::*;
|
||||||
use proto::Mode::*;
|
|
||||||
use proto::ChannelMode as M;
|
use proto::ChannelMode as M;
|
||||||
|
use proto::Mode::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_access_level() {
|
fn parse_access_level() {
|
||||||
|
|
|
@ -4,13 +4,7 @@ use std::collections::HashMap;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::{Arc, Mutex, RwLock};
|
use std::sync::{Arc, Mutex, RwLock};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use error;
|
|
||||||
use client::conn::Connection;
|
|
||||||
use client::data::{Config, User};
|
|
||||||
use client::server::utils::ServerExt;
|
|
||||||
use client::transport::LogView;
|
|
||||||
use proto::{ChannelMode, Command, Message, Mode, Response};
|
|
||||||
use proto::Command::{JOIN, NICK, NICKSERV, PART, PRIVMSG, ChannelMODE, 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;
|
||||||
|
@ -20,6 +14,14 @@ use futures::sync::mpsc::UnboundedSender;
|
||||||
use time;
|
use time;
|
||||||
use tokio_core::reactor::Core;
|
use tokio_core::reactor::Core;
|
||||||
|
|
||||||
|
use error;
|
||||||
|
use client::conn::Connection;
|
||||||
|
use client::data::{Config, User};
|
||||||
|
use client::server::utils::ServerExt;
|
||||||
|
use client::transport::LogView;
|
||||||
|
use proto::{ChannelMode, Command, Message, Mode, Response};
|
||||||
|
use proto::Command::{JOIN, NICK, NICKSERV, PART, PRIVMSG, ChannelMODE, QUIT};
|
||||||
|
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
/// An interface for interacting with an IRC server.
|
/// An interface for interacting with an IRC server.
|
||||||
|
@ -555,17 +557,19 @@ impl IrcServer {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::{IrcServer, Server};
|
|
||||||
use std::thread;
|
|
||||||
use std::time::Duration;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
use std::thread;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use futures::{Future, Stream};
|
||||||
|
|
||||||
|
use super::{IrcServer, Server};
|
||||||
use client::data::Config;
|
use client::data::Config;
|
||||||
#[cfg(not(feature = "nochanlists"))]
|
#[cfg(not(feature = "nochanlists"))]
|
||||||
use client::data::User;
|
use client::data::User;
|
||||||
use proto::{ChannelMode, Mode};
|
use proto::{ChannelMode, Mode};
|
||||||
use proto::command::Command::{PART, PRIVMSG};
|
use proto::command::Command::{PART, PRIVMSG};
|
||||||
use futures::{Future, Stream};
|
|
||||||
|
|
||||||
pub fn test_config() -> Config {
|
pub fn test_config() -> Config {
|
||||||
Config {
|
Config {
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
//! Utilities and shortcuts for working with IRC servers.
|
//! Utilities and shortcuts for working with IRC servers.
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
|
|
||||||
|
#[cfg(feature = "ctcp")]
|
||||||
|
use time;
|
||||||
|
|
||||||
use error::Result;
|
use error::Result;
|
||||||
use proto::{Capability, Command, Mode, NegotiationVersion};
|
use proto::{Capability, Command, Mode, NegotiationVersion};
|
||||||
|
use proto::command::CapSubCommand::{END, LS, REQ};
|
||||||
use proto::command::Command::*;
|
use proto::command::Command::*;
|
||||||
use proto::mode::ModeType;
|
use proto::mode::ModeType;
|
||||||
use client::server::Server;
|
use client::server::Server;
|
||||||
use proto::command::CapSubCommand::{END, LS, REQ};
|
|
||||||
#[cfg(feature = "ctcp")]
|
|
||||||
use time;
|
|
||||||
|
|
||||||
/// Extensions for Server capabilities that make it easier to work directly with the protocol.
|
/// Extensions for Server capabilities that make it easier to work directly with the protocol.
|
||||||
pub trait ServerExt: Server {
|
pub trait ServerExt: Server {
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::sync::{Arc, RwLock, RwLockReadGuard};
|
use std::sync::{Arc, RwLock, RwLockReadGuard};
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use error;
|
|
||||||
use client::data::Config;
|
|
||||||
use proto::{Command, IrcCodec, Message};
|
|
||||||
use futures::{Async, Poll, Sink, StartSend, Stream};
|
use futures::{Async, Poll, Sink, StartSend, Stream};
|
||||||
use tokio_io::{AsyncRead, AsyncWrite};
|
use tokio_io::{AsyncRead, AsyncWrite};
|
||||||
use tokio_io::codec::Framed;
|
use tokio_io::codec::Framed;
|
||||||
|
|
||||||
|
use error;
|
||||||
|
use client::data::Config;
|
||||||
|
use proto::{Command, IrcCodec, Message};
|
||||||
|
|
||||||
/// An IRC transport that handles automatically replying to PINGs.
|
/// An IRC transport that handles automatically replying to PINGs.
|
||||||
pub struct IrcTransport<T>
|
pub struct IrcTransport<T>
|
||||||
where
|
where
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//! Enumeration of all available client commands.
|
//! Enumeration of all available client commands.
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use error;
|
use error;
|
||||||
use proto::{ChannelMode, Mode, Response, UserMode};
|
use proto::{ChannelMode, Mode, Response, UserMode};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
//! Implementation of IRC codec for Tokio.
|
//! Implementation of IRC codec for Tokio.
|
||||||
|
|
||||||
use error;
|
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
use tokio_io::codec::{Decoder, Encoder};
|
use tokio_io::codec::{Decoder, Encoder};
|
||||||
|
|
||||||
|
use error;
|
||||||
use proto::line::LineCodec;
|
use proto::line::LineCodec;
|
||||||
use proto::message::Message;
|
use proto::message::Message;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
//! Implementation of line-delimiting codec for Tokio.
|
//! Implementation of line-delimiting codec for Tokio.
|
||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use error;
|
|
||||||
use bytes::{BufMut, BytesMut};
|
use bytes::{BufMut, BytesMut};
|
||||||
use encoding::{DecoderTrap, EncoderTrap, EncodingRef};
|
use encoding::{DecoderTrap, EncoderTrap, EncodingRef};
|
||||||
use encoding::label::encoding_from_whatwg_label;
|
use encoding::label::encoding_from_whatwg_label;
|
||||||
use tokio_io::codec::{Decoder, Encoder};
|
use tokio_io::codec::{Decoder, Encoder};
|
||||||
|
|
||||||
|
use error;
|
||||||
|
|
||||||
/// A line-based codec parameterized by an encoding.
|
/// A line-based codec parameterized by an encoding.
|
||||||
pub struct LineCodec {
|
pub struct LineCodec {
|
||||||
encoding: EncodingRef,
|
encoding: EncodingRef,
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::fmt::{Display, Formatter, Result as FmtResult};
|
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 proto::Command;
|
use proto::Command;
|
||||||
|
|
Loading…
Reference in a new issue