Skip to main content

NetBenchSession

Trait NetBenchSession 

Source
pub trait NetBenchSession: Send + Sync {
    // Required methods
    fn remote_peer_id(&self) -> String;
    fn telemetry(&self) -> NetBenchTelemetry;
    fn max_datagram_size(&self) -> Option<usize>;
    fn open_bi<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn NetBenchBidirectionalStream>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn accept_bi<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn NetBenchBidirectionalStream>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_datagram<'life0, 'async_trait>(
        &'life0 self,
        bytes: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read_datagram<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A flow-scoped view of one caller-owned authenticated peer session.

Implementations perform typed Stream and Datagram demultiplexing. Therefore accept_bi and read_datagram must never return traffic belonging to another host business flow.

Required Methods§

Source

fn remote_peer_id(&self) -> String

Stable, non-secret remote identity for the report.

Source

fn telemetry(&self) -> NetBenchTelemetry

Samples path and transport counters without active probing.

Source

fn max_datagram_size(&self) -> Option<usize>

Current maximum application Datagram payload.

Source

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

Opens one stream already typed as part of this netbench flow.

Source

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

Accepts the next stream already routed to this netbench flow.

Source

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

Sends one flow-scoped unreliable Datagram.

Source

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

Reads the next Datagram routed to this flow.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§