Skip to main content

MeshTransport

Trait MeshTransport 

Source
pub trait MeshTransport:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn listen<'life0, 'life1, 'async_trait>(
        &'life0 self,
        addr: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn TransportListener>, MeshError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn connect<'life0, 'life1, 'async_trait>(
        &'life0 self,
        addr: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn MeshStream>, MeshError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn supports(&self, addr: &str) -> bool;
}
Expand description

Transport-agnostic mesh transport interface.

Implementations provide concrete connection semantics (QUIC, TCP, WebSocket, etc.) while the mesh layer stays transport-neutral.

Required Methods§

Source

fn name(&self) -> &str

Human-readable transport name (e.g., “quic”, “websocket”, “tcp”).

Source

fn listen<'life0, 'life1, 'async_trait>( &'life0 self, addr: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn TransportListener>, MeshError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Start listening for incoming connections on the given address.

Source

fn connect<'life0, 'life1, 'async_trait>( &'life0 self, addr: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn MeshStream>, MeshError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Connect to a remote peer at the given address.

Source

fn supports(&self, addr: &str) -> bool

Check if this transport supports the given address scheme.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§