aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
blob: 6ec60db5153f9f440e05731af6508bab47daccd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#![feature(plugin, custom_derive, slice_patterns)]
#![plugin(regex_macros)]

#![deny(warnings)]
#![allow(unused_imports)]

extern crate regex;
#[macro_use]
extern crate log;
#[cfg(feature = "ssl")]
extern crate openssl;

pub mod client;
pub mod color;
pub mod ident;
pub mod callback;
pub mod message;
pub mod command;
pub mod reply;

use std::io;
use std::result;

#[cfg(feature = "ssl")]
use openssl::ssl::error::SslError;

pub use ident::Ident;
pub use message::{ Message, MsgType };
pub use command::Command;
pub use reply::Reply;

#[derive(Debug)]
pub enum IrscError {
    Io(io::Error),
    AlreadyConnected,
    NotConnected,
    NotFound,
    #[cfg(feature = "ssl")]
    Ssl(SslError)
}

#[cfg(feature = "ssl")]
impl From<SslError> for IrscError {
    fn from(e: SslError) -> IrscError { IrscError::Ssl(e) }
}

pub type Result<T> = result::Result<T, IrscError>;

pub const DEBUG: bool = cfg!(not(ndebug));