[][src]Struct swagger::drop_context::DropContext

pub struct DropContext<T, C> { /* 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 AddContextService.

Example Usage

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

This example is not tested
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>
[src]

Create a new DropContext struct wrapping a value

Trait Implementations

impl<T: Debug, C: Debug> Debug for DropContext<T, C>
[src]

Formats the value using the given formatter. Read more

impl<T, C> Service for DropContext<T, C> where
    T: Service<Request = Request, Response = Response, Error = Error>, 
[src]

Requests handled by the service.

Responses given by the service.

Errors produced by the service.

The future response value.

Process the request and return the response asynchronously.

impl<T, C> NewService for DropContext<T, C> where
    T: NewService<Request = Request, Response = Response, Error = Error>, 
[src]

Requests handled by the service

Responses given by the service

Errors produced by the service

The Service value created by this factory

Create and return a new service value.

Auto Trait Implementations

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

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

Blanket Implementations

impl<T, U, V, W> BoxedNewService for T where
    T: NewService<Request = U, Response = V, Error = W>,
    <T as NewService>::Instance: Service,
    <T as NewService>::Instance: 'static,
    <<T as NewService>::Instance as Service>::Future == Box<dyn Future<Item = V, Error = W> + 'static>, 
[src]

Call the new_service method of the wrapped NewService and Box the result

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<F, R> NewService for F where
    F: Fn() -> Result<R, Error>,
    R: Service, 

Requests handled by the service

Responses given by the service

Errors produced by the service

The Service value created by this factory

Create and return a new service value.

impl<T> Erased for T