Trait State

Source
pub trait State {
    type Event;
    type Error;

    // Required methods
    fn enqueue_input(&mut self, bytes: &[u8]);
    fn next(&mut self) -> Result<Self::Event, Interrupt<Self::Error>>;
}
Expand description

State machine with sans I/O pattern.

This trait is the interface between types that implement IMAP protocol flows and I/O drivers. Most notably Client and Server both implement this trait whereas Stream uses the trait for implementing the I/O drivers.

Required Associated Types§

Source

type Event

Event emitted while progressing the state.

Source

type Error

Error emitted while progressing the state.

Required Methods§

Source

fn enqueue_input(&mut self, bytes: &[u8])

Enqueue input bytes.

These bytes may be used during the next Self::next call.

Source

fn next(&mut self) -> Result<Self::Event, Interrupt<Self::Error>>

Progress the state until the next event (or interrupt).

Implementations on Foreign Types§

Source§

impl<F: State> State for &mut F

Source§

type Event = <F as State>::Event

Source§

type Error = <F as State>::Error

Source§

fn enqueue_input(&mut self, bytes: &[u8])

Source§

fn next(&mut self) -> Result<Self::Event, Interrupt<Self::Error>>

Implementors§