Trait imap_next::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

§

type Event = <F as State>::Event

§

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§