Trait rama::tcp::client::service::TcpStreamConnectorFactory

pub trait TcpStreamConnectorFactory<State>:
    Send
    + Sync
    + 'static {
    type Connector: TcpStreamConnector;
    type Error;

    // Required method
    fn make_connector(
        &self,
        ctx: Context<State>,
    ) -> impl Future<Output = Result<CreatedTcpStreamConnector<State, Self::Connector>, Self::Error>> + Send;
}
Expand description

Factory to create a TcpStreamConnector. This is used by the TCP stream service to create a stream within a specific Context.

In the most simplest case you use a TcpStreamConnectorCloneFactory to use a Cloneable TcpStreamConnectorCloneFactory, but in more advanced cases you can use variants of TcpStreamConnector specific to the given contexts.

Examples why you might variants:

  • you might have specific needs for your sockets (e.g. bind to a specific interface) that you do not have for all your egress traffic. A crate such as [socket2] can help you with this;
  • it is possible that you have specific filter or firewall needs for some of your egress traffic but not all of it.

Required Associated Types§

type Connector: TcpStreamConnector

TcpStreamConnector created by this TcpStreamConnectorFactory

type Error

Error returned in case TcpStreamConnectorFactory was not able to create a TcpStreamConnector.

Required Methods§

fn make_connector( &self, ctx: Context<State>, ) -> impl Future<Output = Result<CreatedTcpStreamConnector<State, Self::Connector>, Self::Error>> + Send

Try to create a TcpStreamConnector, and return an error or otherwise.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl<State> TcpStreamConnectorFactory<State> for ()
where State: Send + Sync + 'static,

§

type Connector = ()

§

type Error = Infallible

§

fn make_connector( &self, ctx: Context<State>, ) -> impl Future<Output = Result<CreatedTcpStreamConnector<State, <() as TcpStreamConnectorFactory<State>>::Connector>, <() as TcpStreamConnectorFactory<State>>::Error>> + Send

§

impl<State, F> TcpStreamConnectorFactory<State> for Arc<F>
where F: TcpStreamConnectorFactory<State>, State: Send + Sync + 'static,

§

type Connector = <F as TcpStreamConnectorFactory<State>>::Connector

§

type Error = <F as TcpStreamConnectorFactory<State>>::Error

§

fn make_connector( &self, ctx: Context<State>, ) -> impl Future<Output = Result<CreatedTcpStreamConnector<State, <Arc<F> as TcpStreamConnectorFactory<State>>::Connector>, <Arc<F> as TcpStreamConnectorFactory<State>>::Error>> + Send

Implementors§

§

impl<State, A, B> TcpStreamConnectorFactory<State> for Either<A, B>

§

impl<State, A, B, C> TcpStreamConnectorFactory<State> for Either3<A, B, C>

§

impl<State, A, B, C, D> TcpStreamConnectorFactory<State> for Either4<A, B, C, D>

§

impl<State, A, B, C, D, E> TcpStreamConnectorFactory<State> for Either5<A, B, C, D, E>
where State: Send + Sync + 'static, A: TcpStreamConnectorFactory<State>, <A as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<A as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <A as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, B: TcpStreamConnectorFactory<State>, <B as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<B as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <B as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, C: TcpStreamConnectorFactory<State>, <C as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<C as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <C as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, D: TcpStreamConnectorFactory<State>, <D as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<D as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <D as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, E: TcpStreamConnectorFactory<State>, <E as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<E as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <E as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>,

§

impl<State, A, B, C, D, E, F> TcpStreamConnectorFactory<State> for Either6<A, B, C, D, E, F>
where State: Send + Sync + 'static, A: TcpStreamConnectorFactory<State>, <A as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<A as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <A as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, B: TcpStreamConnectorFactory<State>, <B as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<B as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <B as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, C: TcpStreamConnectorFactory<State>, <C as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<C as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <C as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, D: TcpStreamConnectorFactory<State>, <D as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<D as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <D as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, E: TcpStreamConnectorFactory<State>, <E as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<E as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <E as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, F: TcpStreamConnectorFactory<State>, <F as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<F as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <F as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>,

§

impl<State, A, B, C, D, E, F, G> TcpStreamConnectorFactory<State> for Either7<A, B, C, D, E, F, G>
where State: Send + Sync + 'static, A: TcpStreamConnectorFactory<State>, <A as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<A as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <A as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, B: TcpStreamConnectorFactory<State>, <B as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<B as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <B as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, C: TcpStreamConnectorFactory<State>, <C as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<C as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <C as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, D: TcpStreamConnectorFactory<State>, <D as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<D as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <D as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, E: TcpStreamConnectorFactory<State>, <E as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<E as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <E as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, F: TcpStreamConnectorFactory<State>, <F as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<F as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <F as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, G: TcpStreamConnectorFactory<State>, <G as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<G as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <G as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>,

§

impl<State, A, B, C, D, E, F, G, H> TcpStreamConnectorFactory<State> for Either8<A, B, C, D, E, F, G, H>
where State: Send + Sync + 'static, A: TcpStreamConnectorFactory<State>, <A as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<A as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <A as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, B: TcpStreamConnectorFactory<State>, <B as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<B as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <B as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, C: TcpStreamConnectorFactory<State>, <C as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<C as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <C as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, D: TcpStreamConnectorFactory<State>, <D as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<D as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <D as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, E: TcpStreamConnectorFactory<State>, <E as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<E as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <E as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, F: TcpStreamConnectorFactory<State>, <F as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<F as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <F as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, G: TcpStreamConnectorFactory<State>, <G as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<G as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <G as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, H: TcpStreamConnectorFactory<State>, <H as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<H as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <H as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>,

§

impl<State, A, B, C, D, E, F, G, H, I> TcpStreamConnectorFactory<State> for Either9<A, B, C, D, E, F, G, H, I>
where State: Send + Sync + 'static, A: TcpStreamConnectorFactory<State>, <A as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<A as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <A as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, B: TcpStreamConnectorFactory<State>, <B as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<B as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <B as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, C: TcpStreamConnectorFactory<State>, <C as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<C as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <C as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, D: TcpStreamConnectorFactory<State>, <D as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<D as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <D as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, E: TcpStreamConnectorFactory<State>, <E as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<E as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <E as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, F: TcpStreamConnectorFactory<State>, <F as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<F as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <F as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, G: TcpStreamConnectorFactory<State>, <G as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<G as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <G as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, H: TcpStreamConnectorFactory<State>, <H as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<H as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <H as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>, I: TcpStreamConnectorFactory<State>, <I as TcpStreamConnectorFactory<State>>::Connector: TcpStreamConnector, <<I as TcpStreamConnectorFactory<State>>::Connector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>, <I as TcpStreamConnectorFactory<State>>::Error: Into<Box<dyn Error + Sync + Send>>,

§

impl<State, C> TcpStreamConnectorFactory<State> for TcpStreamConnectorCloneFactory<C>
where C: TcpStreamConnector + Clone, State: Send + Sync + 'static,