IterSink

Trait IterSink 

Source
pub trait IterSink<Item> {
    type Error;

    // Required methods
    fn ready(&mut self) -> Result<(), Self::Error>;
    fn start_send(&mut self, item: Item) -> Result<(), Self::Error>;
    fn flush(&mut self) -> Result<(), Self::Error>;
}
Expand description

An IterSink is a value into which other values can be sent.

Values are sent in two phases: first by internally buffering the value, and then actually writing the value upon flushing.

Required Associated Types§

Source

type Error

The type of value produced by the sink when an error occurs.

Required Methods§

Source

fn ready(&mut self) -> Result<(), Self::Error>

Attempts to prepare the IterSink to receive a value, adjusting the internal buffer if necessary.

This method must be called prior to each call to start_send.

Source

fn start_send(&mut self, item: Item) -> Result<(), Self::Error>

Write a value to the internal buffer. Each call to this function must be preceded by a successful call to ready.

Source

fn flush(&mut self) -> Result<(), Self::Error>

Flush any remaining output from this sink’s internal buffer.

Implementors§

Source§

impl<T, E, I> IterSink<I> for FramedWrite<T, E>
where T: Write, E: Encoder<I>,

Source§

type Error = <E as Encoder<I>>::Error

Source§

impl<T, U, I> IterSink<I> for Framed<T, U>
where T: Write, U: Encoder<I>,

Source§

type Error = <U as Encoder<I>>::Error