[][src]Struct swagger::composites::CompositeMakeService

pub struct CompositeMakeService<C, U, V, W>(_)
where
    V: NotFound<V> + 'static,
    W: 'static
;

Wraps a vector of pairs, each consisting of a base path as a &'static str and a MakeService instance. Implements Deref<Vec> and DerefMut<Vec> so these can be manipulated using standard Vec methods.

The Service returned by calling make_service() will pass an incoming request to the first Service in the list for which the associated base path is a prefix of the request path.

Example Usage

This example is not tested
let my_make_service1 = MakeService1::new();
let my_make_service2 = MakeService2::new();

let mut composite_make_service = CompositeMakeService::new();
composite_make_service.push(("/base/path/1", my_make_service1));
composite_make_service.push(("/base/path/2", my_make_service2));

// use as you would any `MakeService` instance

Methods

impl<C, U, V: NotFound<V>, W> CompositeMakeService<C, U, V, W>[src]

pub fn new() -> Self[src]

create an empty CompositeMakeService

Trait Implementations

impl<C, U, V, W> Debug for CompositeMakeService<C, U, V, W> where
    V: NotFound<V> + 'static,
    W: 'static, 
[src]

impl<C: Default, U: Default, V: Default, W: Default> Default for CompositeMakeService<C, U, V, W> where
    V: NotFound<V> + 'static,
    W: 'static, 
[src]

impl<C, U, V, W> Deref for CompositeMakeService<C, U, V, W> where
    V: NotFound<V> + 'static,
    W: 'static, 
[src]

type Target = Vec<(&'static str, Box<dyn BoxedMakeService<C, U, V, W>>)>

The resulting type after dereferencing.

impl<C, U, V, W> DerefMut for CompositeMakeService<C, U, V, W> where
    V: NotFound<V> + 'static,
    W: 'static, 
[src]

impl<'a, C, U, V, W> MakeService<&'a C> for CompositeMakeService<&'a C, U, V, W> where
    U: Payload,
    V: NotFound<V> + 'static + Payload,
    W: Error + Send + Sync + 'static, 
[src]

type ReqBody = U

The Payload body of the http::Request.

type ResBody = V

The Payload body of the http::Response.

type Error = W

The error type that can be returned by Services.

type Service = CompositeService<U, V, W>

The resolved Service from new_service().

type MakeError = Error

The error type that can be returned when creating a new Service.

type Future = FutureResult<Self::Service, Error>

The future returned from new_service of a Service.

Auto Trait Implementations

impl<C, U, V, W> !RefUnwindSafe for CompositeMakeService<C, U, V, W>

impl<C, U, V, W> !Send for CompositeMakeService<C, U, V, W>

impl<C, U, V, W> !Sync for CompositeMakeService<C, U, V, W>

impl<C, U, V, W> Unpin for CompositeMakeService<C, U, V, W>

impl<C, U, V, W> !UnwindSafe for CompositeMakeService<C, U, V, W>

Blanket Implementations

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

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

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

impl<'a, SC, T, Rq, Rs, Er, S> BoxedMakeService<&'a SC, Rq, Rs, Er> for T where
    Er: Error + Send + Sync + 'static,
    Rq: Payload,
    Rs: Payload,
    S: Service<ReqBody = Rq, ResBody = Rs, Error = Er, Future = Box<dyn Future<Item = Response<Rs>, Error = Er> + 'static>> + 'static,
    T: MakeService<&'a SC, ReqBody = Rq, ResBody = Rs, Error = Er, Future = FutureResult<S, Error>, Service = S, MakeError = Error>, 
[src]

fn boxed_make_service(
    &mut Self,
    &'a SC
) -> Result<Box<dyn Service<Error = Er, Future = Box<dyn Future<Item = Response<Rs>, Error = Er> + 'static>, ResBody = Rs, ReqBody = Rq> + 'static>, Error>
[src]

Call the make_service method of the wrapped MakeService and Box the result

impl<T> From<T> for T[src]

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

impl<N, Ctx> MakeService<Ctx> for N where
    N: NewService
[src]

type ReqBody = <N as NewService>::ReqBody

The Payload body of the http::Request.

type ResBody = <N as NewService>::ResBody

The Payload body of the http::Response.

type Error = <N as NewService>::Error

The error type that can be returned by Services.

type Service = <N as NewService>::Service

The resolved Service from new_service().

type Future = <N as NewService>::Future

The future returned from new_service of a Service.

type MakeError = <N as NewService>::InitError

The error type that can be returned when creating a new Service.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.