pub struct DropContextMakeService<T, C>where
    C: Send + 'static,{ /* private fields */ }
Expand description

Middleware wrapper service that drops the context from the incoming request and passes the plain hyper::Request to the wrapped service.

This service can be used to to include services that take a plain hyper::Request in a CompositeService wrapped in an AddContextService.

Example Usage

In the following example SwaggerService implements hyper::service::MakeService with Request = (hyper::Request, SomeContext), and PlainService implements it with Request = hyper::Request

let swagger_service_one = SwaggerService::new();
let swagger_service_two = SwaggerService::new();
let plain_service = PlainService::new();

let mut composite_new_service = CompositeMakeService::new();
composite_new_service.push(("/base/path/1", swagger_service_one));
composite_new_service.push(("/base/path/2", swagger_service_two));
composite_new_service.push(("/base/path/3", DropContextMakeService::new(plain_service)));

Implementations§

source§

impl<T, C> DropContextMakeService<T, C>where C: Send + 'static,

source

pub fn new(inner: T) -> Self

Create a new DropContextMakeService struct wrapping a value

Trait Implementations§

source§

impl<T: Debug, C> Debug for DropContextMakeService<T, C>where C: Send + 'static + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Inner, Context, Target> Service<Target> for DropContextMakeService<Inner, Context>where Context: Send + 'static, Inner: Service<Target>, Inner::Future: Send + 'static,

§

type Response = DropContextService<<Inner as Service<Target>>::Response, Context>

Responses given by the service.
§

type Error = <Inner as Service<Target>>::Error

Errors produced by the service.
§

type Future = Pin<Box<dyn Future<Output = Result<<DropContextMakeService<Inner, Context> as Service<Target>>::Response, <DropContextMakeService<Inner, Context> as Service<Target>>::Error>> + Send, Global>>

The future response value.
source§

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
source§

fn call(&mut self, target: Target) -> Self::Future

Process the request and return the response asynchronously. Read more

Auto Trait Implementations§

§

impl<T, C> RefUnwindSafe for DropContextMakeService<T, C>where C: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, C> Send for DropContextMakeService<T, C>where T: Send,

§

impl<T, C> Sync for DropContextMakeService<T, C>where C: Sync, T: Sync,

§

impl<T, C> Unpin for DropContextMakeService<T, C>where C: Unpin, T: Unpin,

§

impl<T, C> UnwindSafe for DropContextMakeService<T, C>where C: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

source§

fn subset( self ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U, I> LiftInto<U, I> for Twhere U: LiftFrom<T, I>,

source§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Typeable for Twhere T: Any,

§

fn get_type(&self) -> TypeId

Get the TypeId of this object.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more