pub struct HeaderConfigService<T, S> { /* private fields */ }
Expand description
A Service
which extracts a header config from a request or response
and inserts it into the Extensions
of that object.
Implementations§
Source§impl<T, S> HeaderConfigService<T, S>
impl<T, S> HeaderConfigService<T, S>
Sourcepub const fn new(inner: S, header_name: HeaderName, optional: bool) -> Self
pub const fn new(inner: S, header_name: HeaderName, optional: bool) -> Self
Create a new HeaderConfigService
.
Alias for HeaderConfigService::required
if !optional
and HeaderConfigService::optional
if optional
.
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self
, returning the underlying service.
Sourcepub const fn required(inner: S, header_name: HeaderName) -> Self
pub const fn required(inner: S, header_name: HeaderName) -> Self
Create a new HeaderConfigService
with the given inner service
and header name, on which to extract the config,
and which will fail if the header is missing.
Sourcepub const fn optional(inner: S, header_name: HeaderName) -> Self
pub const fn optional(inner: S, header_name: HeaderName) -> Self
Create a new HeaderConfigService
with the given inner service
and header name, on which to extract the config,
and which will gracefully accept if the header is missing.
Trait Implementations§
Source§impl<T, S> Clone for HeaderConfigService<T, S>where
S: Clone,
impl<T, S> Clone for HeaderConfigService<T, S>where
S: Clone,
Source§impl<T, S: Debug> Debug for HeaderConfigService<T, S>
impl<T, S: Debug> Debug for HeaderConfigService<T, S>
Source§impl<T, S, State, Body, E> Service<State, Request<Body>> for HeaderConfigService<T, S>
impl<T, S, State, Body, E> Service<State, Request<Body>> for HeaderConfigService<T, S>
Source§type Response = <S as Service<State, Request<Body>>>::Response
type Response = <S as Service<State, Request<Body>>>::Response
The type of response returned by the service.
Auto Trait Implementations§
impl<T, S> !Freeze for HeaderConfigService<T, S>
impl<T, S> RefUnwindSafe for HeaderConfigService<T, S>where
S: RefUnwindSafe,
impl<T, S> Send for HeaderConfigService<T, S>where
S: Send,
impl<T, S> Sync for HeaderConfigService<T, S>where
S: Sync,
impl<T, S> Unpin for HeaderConfigService<T, S>where
S: Unpin,
impl<T, S> UnwindSafe for HeaderConfigService<T, S>where
S: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, State, Request, Connection> ConnectorService<State, Request> for S
impl<S, State, Request, Connection> ConnectorService<State, Request> for S
Source§type Connection = Connection
type Connection = Connection
Connection returned by the
ConnectorService
Source§type Error = <S as Service<State, Request>>::Error
type Error = <S as Service<State, Request>>::Error
Error returned in case of connection / setup failure
Source§fn connect(
&self,
ctx: Context<State>,
req: Request,
) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<State, Request>>::Connection, State, Request>, <S as ConnectorService<State, Request>>::Error>> + Send
fn connect( &self, ctx: Context<State>, req: Request, ) -> impl Future<Output = Result<EstablishedClientConnection<<S as ConnectorService<State, Request>>::Connection, State, Request>, <S as ConnectorService<State, Request>>::Error>> + Send
Establish a connection, which often involves some kind of handshake,
or connection revival.
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<State, S, Body> HttpClientExt<State> for S
impl<State, S, Body> HttpClientExt<State> for S
Source§type ExecuteResponse = Response<Body>
type ExecuteResponse = Response<Body>
The response type returned by the
execute
method.Source§type ExecuteError = <S as Service<State, Request<Body>>>::Error
type ExecuteError = <S as Service<State, Request<Body>>>::Error
The error type returned by the
execute
method.Source§fn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn get( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
Convenience method to make a
GET
request to a URL. Read moreSource§fn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn post( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
Convenience method to make a
POST
request to a URL. Read moreSource§fn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn put( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
Convenience method to make a
PUT
request to a URL. Read moreSource§fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn patch( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
Convenience method to make a
PATCH
request to a URL. Read moreSource§fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn delete( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
Convenience method to make a
DELETE
request to a URL. Read moreSource§fn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn head( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
Convenience method to make a
HEAD
request to a URL. Read moreSource§fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn request( &self, method: Method, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
Source§fn execute(
&self,
ctx: Context<State>,
request: Request<Body>,
) -> impl Future<Output = Result<<S as HttpClientExt<State>>::ExecuteResponse, <S as HttpClientExt<State>>::ExecuteError>>
fn execute( &self, ctx: Context<State>, request: Request<Body>, ) -> impl Future<Output = Result<<S as HttpClientExt<State>>::ExecuteResponse, <S as HttpClientExt<State>>::ExecuteError>>
Executes a
Request
. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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