Struct apollo_router::layers::map_future_with_request_data::MapFutureWithRequestDataService
source · pub struct MapFutureWithRequestDataService<S, RF, MF> { /* private fields */ }Expand description
Service for mapping futures with request data. See ServiceBuilderExt::map_future_with_request_data().
Implementations§
source§impl<S, RF, MF> MapFutureWithRequestDataService<S, RF, MF>
impl<S, RF, MF> MapFutureWithRequestDataService<S, RF, MF>
sourcepub fn new(
inner: S,
req_fn: RF,
map_fn: MF
) -> MapFutureWithRequestDataService<S, RF, MF>where
RF: Clone,
MF: Clone,
pub fn new( inner: S, req_fn: RF, map_fn: MF ) -> MapFutureWithRequestDataService<S, RF, MF>where RF: Clone, MF: Clone,
Create a new instance.
Trait Implementations§
source§impl<R, S, MF, RF, T, E, Fut, ReqData> Service<R> for MapFutureWithRequestDataService<S, RF, MF>where
S: Service<R>,
RF: FnMut(&R) -> ReqData,
MF: FnMut(ReqData, S::Future) -> Fut,
E: From<S::Error>,
Fut: Future<Output = Result<T, E>>,
impl<R, S, MF, RF, T, E, Fut, ReqData> Service<R> for MapFutureWithRequestDataService<S, RF, MF>where S: Service<R>, RF: FnMut(&R) -> ReqData, MF: FnMut(ReqData, S::Future) -> Fut, E: From<S::Error>, Fut: Future<Output = Result<T, E>>,
Auto Trait Implementations§
impl<S, RF, MF> RefUnwindSafe for MapFutureWithRequestDataService<S, RF, MF>where MF: RefUnwindSafe, RF: RefUnwindSafe, S: RefUnwindSafe,
impl<S, RF, MF> Send for MapFutureWithRequestDataService<S, RF, MF>where MF: Send, RF: Send, S: Send,
impl<S, RF, MF> Sync for MapFutureWithRequestDataService<S, RF, MF>where MF: Sync, RF: Sync, S: Sync,
impl<S, RF, MF> Unpin for MapFutureWithRequestDataService<S, RF, MF>where MF: Unpin, RF: Unpin, S: Unpin,
impl<S, RF, MF> UnwindSafe for MapFutureWithRequestDataService<S, RF, MF>where MF: UnwindSafe, RF: UnwindSafe, 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, M1, M2> ClientStreamingService<M1> for Twhere
T: Service<Request<Streaming<M1>>, Response = Response<M2>, Error = Status>,
impl<T, M1, M2> ClientStreamingService<M1> for Twhere T: Service<Request<Streaming<M1>>, Response = Response<M2>, Error = Status>,
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, ReqBody, ResBody> GrpcService<ReqBody> for Twhere
T: Service<Request<ReqBody>, Response = Response<ResBody>>,
<T as Service<Request<ReqBody>>>::Error: Into<Box<dyn Error + Sync + Send>>,
ResBody: Body,
<ResBody as Body>::Error: Into<Box<dyn Error + Sync + Send>>,
impl<T, ReqBody, ResBody> GrpcService<ReqBody> for Twhere T: Service<Request<ReqBody>, Response = Response<ResBody>>, <T as Service<Request<ReqBody>>>::Error: Into<Box<dyn Error + Sync + Send>>, ResBody: Body, <ResBody as Body>::Error: Into<Box<dyn Error + Sync + Send>>,
§type ResponseBody = ResBody
type ResponseBody = ResBody
Responses body given by the service.
source§fn poll_ready(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), <T as GrpcService<ReqBody>>::Error>>
fn poll_ready( &mut self, cx: &mut Context<'_> ) -> Poll<Result<(), <T as GrpcService<ReqBody>>::Error>>
Returns
Ready when the service is able to process requests. 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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Requestsource§impl<M, S, Target, Request> MakeService<Target, Request> for Mwhere
M: Service<Target, Response = S>,
S: Service<Request>,
impl<M, S, Target, Request> MakeService<Target, Request> for Mwhere M: Service<Target, Response = S>, S: Service<Request>,
source§fn poll_ready(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn poll_ready( &mut self, cx: &mut Context<'_> ) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
Returns
Poll::Ready when the factory is able to create more services. Read moresource§fn make_service(
&mut self,
target: Target
) -> <M as MakeService<Target, Request>>::Future
fn make_service( &mut self, target: Target ) -> <M as MakeService<Target, Request>>::Future
Create and return a new service value asynchronously.
source§fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
fn into_service(self) -> IntoService<Self, Request>where Self: Sized,
source§fn as_service(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
fn as_service(&mut self) -> AsService<'_, Self, Request>where Self: Sized,
source§impl<T, S, M1, M2> ServerStreamingService<M1> for Twhere
T: Service<Request<M1>, Response = Response<S>, Error = Status>,
S: Stream<Item = Result<M2, Status>>,
impl<T, S, M1, M2> ServerStreamingService<M1> for Twhere T: Service<Request<M1>, Response = Response<S>, Error = Status>, S: Stream<Item = Result<M2, Status>>,
source§impl<S, R> ServiceExt<R> for Swhere
S: Service<R>,
impl<S, R> ServiceExt<R> for Swhere S: Service<R>,
source§fn into_make_service(self) -> IntoMakeService<S>
fn into_make_service(self) -> IntoMakeService<S>
Convert this service into a
MakeService, that is a Service whose
response is another service. Read moresource§fn into_make_service_with_connect_info<C>(
self
) -> IntoMakeServiceWithConnectInfo<S, C>
fn into_make_service_with_connect_info<C>( self ) -> IntoMakeServiceWithConnectInfo<S, C>
Convert this service into a
MakeService, that will store C’s
associated ConnectInfo in a request extension such that ConnectInfo
can extract it. Read moresource§impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere T: Service<Request> + ?Sized,
source§fn map_first_graphql_response<Callback>(
self,
callback: Callback
) -> MapFirstGraphqlResponseService<Self, Callback>where
Self: Sized + Service<Request, Response = Response>,
<Self as Service<Request>>::Future: Send + 'static,
Callback: FnOnce(Context, Parts, Response) -> (Parts, Response) + Clone + Send + 'static,
fn map_first_graphql_response<Callback>( self, callback: Callback ) -> MapFirstGraphqlResponseService<Self, Callback>where Self: Sized + Service<Request, Response = Response>, <Self as Service<Request>>::Future: Send + 'static, Callback: FnOnce(Context, Parts, Response) -> (Parts, Response) + Clone + Send + 'static,
Maps HTTP parts, as well as the first GraphQL response, to different values. Read more
source§fn map_future_with_request_data<RF, MF>(
self,
req_fn: RF,
map_fn: MF
) -> MapFutureWithRequestDataService<Self, RF, MF>where
Self: Sized,
RF: Clone,
MF: Clone,
fn map_future_with_request_data<RF, MF>( self, req_fn: RF, map_fn: MF ) -> MapFutureWithRequestDataService<Self, RF, MF>where Self: Sized, RF: Clone, MF: Clone,
Similar to map_future but also providing an opportunity to extract information out of the
request for use when constructing the response. Read more
source§impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere T: Service<Request> + ?Sized,
source§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where Self: Sized,
Yields a mutable reference to the service when it is ready to accept a request.
source§fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready_and(&mut self) -> Ready<'_, Self, Request>where Self: Sized,
👎Deprecated since 0.4.6: please use the
ServiceExt::ready method insteadYields a mutable reference to the service when it is ready to accept a request.
source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where Self: Sized,
Yields the service when it is ready to accept a request.
source§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where Self: Sized,
Consume this
Service, calling with the providing request once it is ready.source§fn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
Self: Sized,
Self::Error: Into<Box<dyn Error + Sync + Send>>,
S: Stream<Item = Request>,
fn call_all<S>(self, reqs: S) -> CallAll<Self, S>where Self: Sized, Self::Error: Into<Box<dyn Error + Sync + Send>>, S: Stream<Item = Request>,
source§fn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
F: Clone,
fn and_then<F>(self, f: F) -> AndThen<Self, F>where Self: Sized, F: Clone,
Executes a new future after this service’s future resolves. This does
not alter the behaviour of the
poll_ready method. Read moresource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
Self: Sized,
F: FnOnce(Self::Response) -> Response + Clone,
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where Self: Sized, F: FnOnce(Self::Response) -> Response + Clone,
Maps this service’s response value to a different value. This does not
alter the behaviour of the
poll_ready method. Read moresource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> Error + Clone,
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where Self: Sized, F: FnOnce(Self::Error) -> Error + Clone,
Maps this service’s error value to a different value. This does not
alter the behaviour of the
poll_ready method. Read moresource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where Self: Sized, Error: From<Self::Error>, F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
Maps this service’s result type (
Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read moresource§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>where
Self: Sized,
F: FnMut(NewRequest) -> Request,
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>where Self: Sized, F: FnMut(NewRequest) -> Request,
Composes a function in front of the service. Read more
source§fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>where
Self: Sized,
F: Predicate<NewRequest>,
fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>where Self: Sized, F: Predicate<NewRequest>,
source§fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where Self: Sized, F: AsyncPredicate<NewRequest>,
Composes this service with an
AsyncFilter that conditionally accepts or
rejects requests based on an [async predicate]. Read moresource§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Fut + Clone,
Fut: Future<Output = Result<Response, Error>>,
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>where Self: Sized, Error: From<Self::Error>, F: FnOnce(Result<Self::Response, Self::Error>) -> Fut + Clone, Fut: Future<Output = Result<Response, Error>>,
Composes an asynchronous function after this service. Read more
source§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>where
Self: Sized,
F: FnMut(Self::Future) -> Fut,
Error: From<Self::Error>,
Fut: Future<Output = Result<Response, Error>>,
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>where Self: Sized, F: FnMut(Self::Future) -> Fut, Error: From<Self::Error>, Fut: Future<Output = Result<Response, Error>>,
Composes a function that transforms futures produced by the service. Read more
source§impl<T, S, M1, M2> StreamingService<M1> for Twhere
T: Service<Request<Streaming<M1>>, Response = Response<S>, Error = Status>,
S: Stream<Item = Result<M2, Status>>,
impl<T, S, M1, M2> StreamingService<M1> for Twhere T: Service<Request<Streaming<M1>>, Response = Response<S>, Error = Status>, S: Stream<Item = Result<M2, Status>>,
§type ResponseStream = S
type ResponseStream = S
Stream of outbound response messages