diff --git a/src/lib.rs b/src/lib.rs index bb2e1d8..ba35fb2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,15 +21,25 @@ pub use self::error::*; use std::io::{Read, Write}; use irc_proto::message::Message; +//! This crate provides the `IrcRead` and `IrcWrite` traits and +//! the IrcStream struct that implements them. + +/// A trait that mirrors std::io::Read; +/// It requires the `read()` method that returns an IRC Message. +/// The function may or may not block. pub trait IrcRead{ fn read(&mut self) -> Result; } +/// A trait that mirrors std::io::Write; +/// It requires the `write()` and `flush()` methods that returns an IRC Message. pub trait IrcWrite{ fn write(&mut self, message: Message) -> Result<()>; fn flush(&mut self) -> Result<()>; } +/// A struct that wraps a generic stream implementing std::io::Read and std::io::Write +/// and implements the IrcRead and IrcWrite traits. pub struct IrcStream { stream:S, buffer:String