Trait tor_chanmgr::factory::ChannelFactory

source ·
pub trait ChannelFactory: Send + Sync {
    // Required method
    fn connect_via_transport<'life0, 'life1, 'async_trait>(
        &'life0 self,
        target: &'life1 OwnedChanTarget,
        reporter: BootstrapReporter
    ) -> Pin<Box<dyn Future<Output = Result<Channel>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

An object that knows how to build Channels to ChanTargets.

This trait must be object-safe.

Every ChanMgr has a ChannelFactory that it uses to construct all of its channels.

A ChannelFactory can be implemented in terms of a TransportImplHelper, by wrapping it in a ChanBuilder.

(In fact, as of the time of writing, this is the only way to implement this trait outside of this crate while keeping bootstrap status reporting, since BootstrapReporter is an opaque type.)

Required Methods§

source

fn connect_via_transport<'life0, 'life1, 'async_trait>( &'life0 self, target: &'life1 OwnedChanTarget, reporter: BootstrapReporter ) -> Pin<Box<dyn Future<Output = Result<Channel>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open an authenticated channel to target.

This method does does not necessarily handle retries or timeouts, although some of its implementations may.

This method does not necessarily handle every kind of transport. If the caller provides a target with an unsupported TransportId, this method should return Error::NoSuchTransport.

Trait Implementations§

source§

impl<'a> ChannelFactory for Box<dyn ChannelFactory + Send + Sync + 'a>

source§

fn connect_via_transport<'life0, 'life1, 'async_trait>( &'life0 self, target: &'life1 OwnedChanTarget, reporter: BootstrapReporter ) -> Pin<Box<dyn Future<Output = Result<Channel>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open an authenticated channel to target. Read more

Implementations on Foreign Types§

source§

impl<'a> ChannelFactory for Box<dyn ChannelFactory + Send + Sync + 'a>

source§

fn connect_via_transport<'life0, 'life1, 'async_trait>( &'life0 self, target: &'life1 OwnedChanTarget, reporter: BootstrapReporter ) -> Pin<Box<dyn Future<Output = Result<Channel>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

impl<'a> ChannelFactory for Arc<dyn ChannelFactory + Send + Sync + 'a>

source§

fn connect_via_transport<'life0, 'life1, 'async_trait>( &'life0 self, target: &'life1 OwnedChanTarget, reporter: BootstrapReporter ) -> Pin<Box<dyn Future<Output = Result<Channel>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§