Update 'src/lib.rs'
Added doc comments.
This commit is contained in:
parent
b23709917e
commit
455c49dbb2
1 changed files with 10 additions and 0 deletions
10
src/lib.rs
10
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<Message>;
|
||||
}
|
||||
|
||||
/// 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<S: Read + Write> {
|
||||
stream:S,
|
||||
buffer:String
|
||||
|
|
Loading…
Reference in a new issue