Skip to main content

DuplexTransport

Trait DuplexTransport 

Source
pub trait DuplexTransport: Send {
    // Required methods
    fn read_chunk(
        &mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + '_>>;
    fn write(
        &mut self,
        frame: &str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
}
Expand description

A two-way stream of decoded UTF-8 chunks and outgoing newline-framed MSP.

Inbound chunks may be empty or split at any point; the connection assembles frames. write means a frame was handed to the transport, not that the server completed the command. The implementer decodes bytes incrementally. Neither method creates a runtime: callers drive both on their Tokio runtime.

Required Methods§

Source

fn read_chunk( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + '_>>

Returns the next decoded chunk, or None after transport EOF.

Source

fn write( &mut self, frame: &str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Submits an already newline-framed outgoing message.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§