Struct swagger::drop_context::DropContext
[−]
[src]
pub struct DropContext<T, C> where
C: Default + Push<XSpanIdString>, { /* fields omitted */ }
Middleware wrapper service that trops 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 AddContext
service.
Example Usage
In the following example SwaggerService
implements hyper::server::NewService
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 = CompositeNewService::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", DropContext::new(plain_service)));
Methods
impl<T, C> DropContext<T, C> where
C: Default + Push<XSpanIdString>,
[src]
C: Default + Push<XSpanIdString>,
Trait Implementations
impl<T: Debug, C: Debug> Debug for DropContext<T, C> where
C: Default + Push<XSpanIdString>,
[src]
C: Default + Push<XSpanIdString>,
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T, C> NewService for DropContext<T, C> where
C: Default + Push<XSpanIdString>,
T: NewService<Request = Request, Response = Response, Error = Error>,
[src]
C: Default + Push<XSpanIdString>,
T: NewService<Request = Request, Response = Response, Error = Error>,
type Request = (Request, C::Result)
Requests handled by the service
type Response = Response
Responses given by the service
type Error = Error
Errors produced by the service
type Instance = DropContext<T::Instance, C>
The Service
value created by this factory
fn new_service(&self) -> Result<Self::Instance, Error>
[src]
Create and return a new service value.
impl<T, C> Service for DropContext<T, C> where
C: Default + Push<XSpanIdString>,
T: Service<Request = Request, Response = Response, Error = Error>,
[src]
C: Default + Push<XSpanIdString>,
T: Service<Request = Request, Response = Response, Error = Error>,
type Request = (Request, C::Result)
Requests handled by the service.
type Response = Response
Responses given by the service.
type Error = Error
Errors produced by the service.
type Future = T::Future
The future response value.
fn call(&self, (req, _): Self::Request) -> Self::Future
[src]
Process the request and return the response asynchronously.
Auto Trait Implementations
impl<T, C> Send for DropContext<T, C> where
C: Send,
T: Send,
C: Send,
T: Send,
impl<T, C> Sync for DropContext<T, C> where
C: Sync,
T: Sync,
C: Sync,
T: Sync,