#![forbid(unsafe_code)]
pub mod client;
mod client_send;
mod handle;
mod receive;
pub mod server;
mod server_send;
#[cfg(feature = "stream")]
pub mod stream;
#[cfg(test)]
mod tests;
pub mod types;
pub use imap_codec::imap_types;
#[doc = include_str!("../README.md")]
#[cfg(doctest)]
pub struct ReadmeDoctests;
pub trait State {
type Event;
type Error;
fn enqueue_input(&mut self, bytes: &[u8]);
fn next(&mut self) -> Result<Self::Event, Interrupt<Self::Error>>;
}
impl<F: State> State for &mut F {
type Event = F::Event;
type Error = F::Error;
fn enqueue_input(&mut self, bytes: &[u8]) {
(*self).enqueue_input(bytes);
}
fn next(&mut self) -> Result<Self::Event, Interrupt<Self::Error>> {
(*self).next()
}
}
#[must_use = "If state progression is interrupted the interrupt must be handled. Ignoring this might result in a deadlock on IMAP level"]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Interrupt<E> {
Io(Io),
Error(E),
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Io {
NeedMoreInput,
Output(Vec<u8>),
}