Skip to main content

LinoProtocol

Trait LinoProtocol 

Source
pub trait LinoProtocol:
    Debug
    + Send
    + Sync {
    // Required methods
    fn write_document(
        &self,
        writer: &mut dyn Write,
        document: &[LiNo<String>],
    ) -> ProtocolResult<()>;
    fn read_document(
        &self,
        reader: &mut dyn BufRead,
    ) -> ProtocolResult<Option<LinoDocument>>;
}
Expand description

Reads and writes whole LiNo documents on a byte stream.

Required Methods§

Source

fn write_document( &self, writer: &mut dyn Write, document: &[LiNo<String>], ) -> ProtocolResult<()>

Writes one message carrying document.

Source

fn read_document( &self, reader: &mut dyn BufRead, ) -> ProtocolResult<Option<LinoDocument>>

Reads one message; Ok(None) when the stream ended cleanly.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<P: LinoProtocol + ?Sized> LinoProtocol for Box<P>

Source§

fn write_document( &self, writer: &mut dyn Write, document: &[LiNo<String>], ) -> ProtocolResult<()>

Source§

fn read_document( &self, reader: &mut dyn BufRead, ) -> ProtocolResult<Option<LinoDocument>>

Implementors§