Skip to main content

SessionStreams

Trait SessionStreams 

Source
pub trait SessionStreams: Send + Sync {
    // Required methods
    fn peer_key(&self) -> [u8; 32];
    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 method
    fn is_closed(&self) -> bool { ... }
}
Expand description

One authenticated peer connection (handshake already proved Self::peer_key).

Required Methods§

Source

fn peer_key(&self) -> [u8; 32]

Ed25519 public key proven by the transport handshake.

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 next bidirectional stream.

Source

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

Close the connection with an application code and reason.

Provided Methods§

Source

fn is_closed(&self) -> bool

Whether the peer has already closed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§