Skip to main content

Transport

Trait Transport 

Source
pub trait Transport {
    // Required methods
    fn recv<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Frame>, TransportError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        data: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn peer(&self) -> String;
    fn split(self: Box<Self>) -> (Box<dyn FrameSource>, Box<dyn FrameSink>);
}
Expand description

Abstract bidirectional frame transport.

Implementations must preserve frame boundaries: each value returned by Transport::recv is exactly one SMB frame.

Futures are ?Send: the io_uring TCP transport owns !Send resources and runs entirely on one thread under a tokio_uring runtime.

Required Methods§

Source

fn recv<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<Frame>, TransportError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Receive the next frame. Ok(None) signals a clean end of stream.

Source

fn send<'life0, 'life1, 'async_trait>( &'life0 mut self, data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Transmit one frame.

Source

fn peer(&self) -> String

Human-readable peer description for logs.

Source

fn split(self: Box<Self>) -> (Box<dyn FrameSource>, Box<dyn FrameSink>)

Split into independent read and write halves.

The server drives the read half from its accept loop while a dedicated writer task drains an outbound queue into the write half. This lets background work (async STATUS_PENDING completions, oplock/lease breaks, CHANGE_NOTIFY) emit unsolicited frames without cancelling the blocking recv — critical because recv is not cancel-safe.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§