Skip to main content

Transport

Trait Transport 

Source
pub trait Transport:
    Send
    + Sync
    + 'static {
    // Required methods
    fn open_uni<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<BoxSend>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn accept_uni<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<BoxRecv>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn open_bi<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(BoxSend, BoxRecv)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn accept_bi<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(BoxSend, BoxRecv)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close(&self, code: u32, reason: &[u8]);

    // Provided methods
    fn peer_label(&self) -> String { ... }
    fn bytes_sent(&self) -> Option<u64> { ... }
}

Required Methods§

Source

fn open_uni<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BoxSend>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Open a unidirectional stream for data frames.

Source

fn accept_uni<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BoxRecv>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Accept the next unidirectional stream the peer opened.

Source

fn open_bi<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(BoxSend, BoxRecv)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Open the bidirectional control stream.

Source

fn accept_bi<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(BoxSend, BoxRecv)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Accept the peer’s bidirectional control stream.

Source

fn close(&self, code: u32, reason: &[u8])

Close the connection. Best-effort; never blocks.

Provided Methods§

Source

fn peer_label(&self) -> String

Human-readable peer identity, for logs.

Source

fn bytes_sent(&self) -> Option<u64>

Bytes already sent on this connection, if the transport tracks it. Used to report true wire throughput against post-compression volume.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§