Adding some comments and cleaning up imports

This commit is contained in:
Matt McCoy 2016-06-24 09:54:03 -04:00
parent aa989ce0e5
commit 56edd6c46b
2 changed files with 10 additions and 7 deletions

View file

@ -1,7 +1,6 @@
use std::net::{TcpStream, ToSocketAddrs}; use std::net::{TcpStream, ToSocketAddrs};
use openssl::ssl::{SslContext, SslStream}; use openssl::ssl::{SslContext, SslStream};
use std::io::{Read, Write}; use std::io::{self, Read, Write};
use std::io::{self};
use super::mailbox::Mailbox; use super::mailbox::Mailbox;
use super::parse::{parse_response_ok, parse_capability, parse_select_or_examine}; use super::parse::{parse_response_ok, parse_capability, parse_select_or_examine};

View file

@ -1,6 +1,6 @@
use std::io::{self}; use std::io::Error as IoError;
use std::result; use std::result;
use std::fmt::{self}; use std::fmt;
use std::error::Error as StdError; use std::error::Error as StdError;
use openssl::ssl::error::SslError; use openssl::ssl::error::SslError;
@ -10,14 +10,18 @@ pub type Result<T> = result::Result<T, Error>;
/// A set of errors that can occur in the IMAP client /// A set of errors that can occur in the IMAP client
#[derive(Debug)] #[derive(Debug)]
pub enum Error { pub enum Error {
Io(io::Error), /// An `io::Error` that occurred while trying to read or write to a network stream.
Io(IoError),
/// An error from the `openssl` library.
Ssl(SslError), Ssl(SslError),
/// A BAD response from the IMAP server.
BadResponse(Vec<String>), BadResponse(Vec<String>),
/// A NO response from the IMAP server.
NoResponse(Vec<String>), NoResponse(Vec<String>),
} }
impl From<io::Error> for Error { impl From<IoError> for Error {
fn from(err: io::Error) -> Error { fn from(err: IoError) -> Error {
Error::Io(err) Error::Io(err)
} }
} }