Struct TcpConnector
pub struct TcpConnector<StreamConnector = ()> { /* private fields */ }std and tcp only.Expand description
A connector which can be used to establish a TCP connection to a server.
Implementations§
§impl TcpConnector
impl TcpConnector
pub fn new() -> TcpConnector
pub fn new() -> TcpConnector
Create a new TcpConnector, which is used to establish a connection to a server.
You can use middleware around the TcpConnector
or add connection pools, retry logic and more.
§impl<StreamConnector> TcpConnector<StreamConnector>
impl<StreamConnector> TcpConnector<StreamConnector>
pub fn with_max_in_flight_connect_attempts(
self,
n: usize,
) -> TcpConnector<StreamConnector>
pub fn with_max_in_flight_connect_attempts( self, n: usize, ) -> TcpConnector<StreamConnector>
Set the maximum number of resolved candidate connection attempts
raced concurrently (default 3, clamped to a minimum of 1).
Only takes effect when a ConnectorTargetStream is present on the
input (i.e. a domain target was resolved by an upstream DNS
connector), a single IP target is dialed directly.
pub fn set_max_in_flight_connect_attempts(
&mut self,
n: usize,
) -> &mut TcpConnector<StreamConnector>
pub fn set_max_in_flight_connect_attempts( &mut self, n: usize, ) -> &mut TcpConnector<StreamConnector>
Set the maximum number of resolved candidate connection attempts
raced concurrently (default 3, clamped to a minimum of 1).
Only takes effect when a ConnectorTargetStream is present on the
input (i.e. a domain target was resolved by an upstream DNS
connector), a single IP target is dialed directly.
§impl TcpConnector
impl TcpConnector
pub fn with_connector<StreamConnector>(
self,
connector: StreamConnector,
) -> TcpConnector<StreamConnector>
pub fn with_connector<StreamConnector>( self, connector: StreamConnector, ) -> TcpConnector<StreamConnector>
Consume self to attach the given Connector (a TcpStreamConnector),
used to establish the actual TcpStream.
Trait Implementations§
§impl<StreamConnector> Clone for TcpConnector<StreamConnector>where
StreamConnector: Clone,
impl<StreamConnector> Clone for TcpConnector<StreamConnector>where
StreamConnector: Clone,
§fn clone(&self) -> TcpConnector<StreamConnector>
fn clone(&self) -> TcpConnector<StreamConnector>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<StreamConnector> Debug for TcpConnector<StreamConnector>where
StreamConnector: Debug,
impl<StreamConnector> Debug for TcpConnector<StreamConnector>where
StreamConnector: Debug,
§impl Default for TcpConnector
impl Default for TcpConnector
§fn default() -> TcpConnector
fn default() -> TcpConnector
§impl<Input, StreamConnector> Service<Input> for TcpConnector<StreamConnector>where
Input: ConnectorTargetInputExt + TransportProtocolInputExt + Send + 'static,
StreamConnector: TcpStreamConnector + Send + 'static,
<StreamConnector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>,
impl<Input, StreamConnector> Service<Input> for TcpConnector<StreamConnector>where
Input: ConnectorTargetInputExt + TransportProtocolInputExt + Send + 'static,
StreamConnector: TcpStreamConnector + Send + 'static,
<StreamConnector as TcpStreamConnector>::Error: Into<Box<dyn Error + Sync + Send>>,
§type Output = EstablishedClientConnection<TcpStream, Input>
type Output = EstablishedClientConnection<TcpStream, Input>
§async fn serve(
&self,
input: Input,
) -> Result<<TcpConnector<StreamConnector> as Service<Input>>::Output, <TcpConnector<StreamConnector> as Service<Input>>::Error>
async fn serve( &self, input: Input, ) -> Result<<TcpConnector<StreamConnector> as Service<Input>>::Output, <TcpConnector<StreamConnector> as Service<Input>>::Error>
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Auto Trait Implementations§
impl<StreamConnector> Freeze for TcpConnector<StreamConnector>where
StreamConnector: Freeze,
impl<StreamConnector> RefUnwindSafe for TcpConnector<StreamConnector>where
StreamConnector: RefUnwindSafe,
impl<StreamConnector> Send for TcpConnector<StreamConnector>where
StreamConnector: Send,
impl<StreamConnector> Sync for TcpConnector<StreamConnector>where
StreamConnector: Sync,
impl<StreamConnector> Unpin for TcpConnector<StreamConnector>where
StreamConnector: Unpin,
impl<StreamConnector> UnsafeUnpin for TcpConnector<StreamConnector>where
StreamConnector: UnsafeUnpin,
impl<StreamConnector> UnwindSafe for TcpConnector<StreamConnector>where
StreamConnector: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S, Input, Connection> ConnectorService<Input> for S
impl<S, Input, Connection> ConnectorService<Input> for S
§type Connection = Connection
type Connection = Connection
ConnectorService§fn connect(
&self,
input: Input,
) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Input>>::Connection, Input>, <S as ConnectorService<Input>>::Error>> + Send
fn connect( &self, input: Input, ) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<Input>>::Connection, Input>, <S as ConnectorService<Input>>::Error>> + Send
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<S> IntoEndpointService<(S,)> for S
impl<S> IntoEndpointService<(S,)> for S
type Service = S
§fn into_endpoint_service(self) -> <S as IntoEndpointService<(S,)>>::Service
fn into_endpoint_service(self) -> <S as IntoEndpointService<(S,)>>::Service
rama_core::Service.§impl<S, State> IntoEndpointServiceWithState<(S,), State> for S
impl<S, State> IntoEndpointServiceWithState<(S,), State> for S
type Service = S
§fn into_endpoint_service_with_state(
self,
_state: State,
) -> <S as IntoEndpointServiceWithState<(S,), State>>::Service
fn into_endpoint_service_with_state( self, _state: State, ) -> <S as IntoEndpointServiceWithState<(S,), State>>::Service
rama_core::Service with state.§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more