Trait Connector

Source
pub trait Connector:
    Send
    + Sync
    + 'static {
    type Transport: Transport;

    // Required methods
    fn connect<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 Url,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Transport>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn spawn<Fut: Future<Output = ()> + Send + 'static>(&self, fut: Fut);
}
Expand description

Interface for runtime and tls adapters for the trillium client

See trillium_client for more information on usage.

Required Associated Types§

Required Methods§

Source

fn connect<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Result<Self::Transport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Initiate a connection to the provided url

Async trait signature:

async fn connect(&self, url: &Url) -> std::io::Result<Self::Transport>;
Source

fn spawn<Fut: Future<Output = ()> + Send + 'static>(&self, fut: Fut)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Connector for Box<dyn ObjectSafeConnector>

Source§

type Transport = BoxedTransport

Source§

fn connect<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Result<BoxedTransport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn spawn<Fut: Future<Output = ()> + Send + 'static>(&self, fut: Fut)

Source§

impl Connector for Arc<dyn ObjectSafeConnector>

Source§

type Transport = BoxedTransport

Source§

fn connect<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Result<BoxedTransport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn spawn<Fut: Future<Output = ()> + Send + 'static>(&self, fut: Fut)

Implementors§