use std::io::Error as IoError;
use std::result;
use std::str::Utf8Error;
use base64::DecodeError;
pub type Result<T> = result::Result<T, Error>;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("io: {0}")]
Io(#[from] IoError),
#[error("bad response: {0}")]
Bad(String),
#[error("no response: {0}")]
No(String),
#[error("connection lost")]
ConnectionLost,
#[error("parse: {0}")]
Parse(#[from] ParseError),
#[error("validate: {0}")]
Validate(#[from] ValidateError),
#[error("async_native_tls: {0}")]
NativeTlsError(#[from] async_native_tls::Error),
#[error("could not append mail to mailbox")]
Append,
#[doc(hidden)]
#[error("unknown")]
__Nonexhaustive,
}
#[derive(thiserror::Error, Debug)]
pub enum ParseError {
#[error("unable to parse status response")]
Invalid(Vec<u8>),
#[error("encountered unexpected parsed response: {0}")]
Unexpected(String),
#[error("unable to parse authentication response: {0} - {1:?}")]
Authentication(String, Option<DecodeError>),
#[error("unable to parse data ({0:?}) as UTF-8 text: {1:?}")]
DataNotUtf8(Vec<u8>, #[source] Utf8Error),
}
#[derive(thiserror::Error, Debug)]
#[error("invalid character in input: '{0}'")]
pub struct ValidateError(pub char);
#[cfg(test)]
mod tests {
use super::*;
fn is_send<T: Send>(_t: T) {}
#[test]
fn test_send() {
is_send::<Result<usize>>(Ok(3));
}
}