pub struct MapRequest<S, F> { /* private fields */ }
Expand description
Composes a function in front of the service.
This adapter produces a new service that passes each value through the
given function f
before sending it to self
.
Implementations§
Source§impl<S, F> MapRequest<S, F>
impl<S, F> MapRequest<S, F>
Sourcepub const fn new(inner: S, f: F) -> Self
pub const fn new(inner: S, f: F) -> Self
Creates a new MapRequest
service.
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes self
, returning the underlying service.
Trait Implementations§
Source§impl<S: Clone, F: Clone> Clone for MapRequest<S, F>
impl<S: Clone, F: Clone> Clone for MapRequest<S, F>
Source§fn clone(&self) -> MapRequest<S, F>
fn clone(&self) -> MapRequest<S, F>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<S, F> Debug for MapRequest<S, F>where
S: Debug,
impl<S, F> Debug for MapRequest<S, F>where
S: Debug,
Source§impl<S, F, State, R1, R2> Service<State, R1> for MapRequest<S, F>
impl<S, F, State, R1, R2> Service<State, R1> for MapRequest<S, F>
Source§type Response = <S as Service<State, R2>>::Response
type Response = <S as Service<State, R2>>::Response
The type of response returned by the service.
Auto Trait Implementations§
impl<S, F> Freeze for MapRequest<S, F>
impl<S, F> RefUnwindSafe for MapRequest<S, F>where
S: RefUnwindSafe,
F: RefUnwindSafe,
impl<S, F> Send for MapRequest<S, F>
impl<S, F> Sync for MapRequest<S, F>
impl<S, F> Unpin for MapRequest<S, F>
impl<S, F> UnwindSafe for MapRequest<S, F>where
S: UnwindSafe,
F: 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<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<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<S, StateIn, StateOut, RequestIn, RequestOut> RequestInspector<StateIn, RequestIn> for S
impl<S, StateIn, StateOut, RequestIn, RequestOut> RequestInspector<StateIn, RequestIn> for S
Source§type Error = <S as Service<StateIn, RequestIn>>::Error
type Error = <S as Service<StateIn, RequestIn>>::Error
The type of error returned by the service.
type RequestOut = RequestOut
type StateOut = StateOut
Source§fn inspect_request(
&self,
ctx: Context<StateIn>,
req: RequestIn,
) -> impl Future<Output = Result<(Context<<S as RequestInspector<StateIn, RequestIn>>::StateOut>, <S as RequestInspector<StateIn, RequestIn>>::RequestOut), <S as RequestInspector<StateIn, RequestIn>>::Error>> + Send
fn inspect_request( &self, ctx: Context<StateIn>, req: RequestIn, ) -> impl Future<Output = Result<(Context<<S as RequestInspector<StateIn, RequestIn>>::StateOut>, <S as RequestInspector<StateIn, RequestIn>>::RequestOut), <S as RequestInspector<StateIn, RequestIn>>::Error>> + Send
Inspect the request, modify it if needed or desired, and return it.