[][src]Struct actix_service::ApplyNewService

pub struct ApplyNewService<T, F, In, Out, Request> where
    T: NewService<Request>, 
{ /* fields omitted */ }

ApplyNewService new service combinator

Methods

impl<T, F, In, Out, Request> ApplyNewService<T, F, In, Out, Request> where
    T: NewService<Request>,
    F: Fn(In, &mut T::Service) -> Out,
    Out: IntoFuture,
    Out::Error: From<T::Error>, 
[src]

pub fn new<F1: IntoNewService<T, Request>>(service: F1, f: F) -> Self
[src]

Create new ApplyNewService new service instance

Trait Implementations

impl<T, F, In, Out, Request> NewService<In> for ApplyNewService<T, F, In, Out, Request> where
    T: NewService<Request>,
    F: Fn(In, &mut T::Service) -> Out + Clone,
    Out: IntoFuture,
    Out::Error: From<T::Error>, 
[src]

type Response = Out::Item

Responses given by the service

type Error = Out::Error

Errors produced by the service

type Service = Apply<T::Service, F, In, Out, Request>

The Service value created by this factory

type InitError = T::InitError

Errors produced while building a service.

type Future = ApplyNewServiceFuture<T, F, In, Out, Request>

The future of the Service instance.

fn apply<T, I, F, Out, Req>(
    self,
    service: I,
    f: F
) -> AndThenNewService<Self, ApplyNewService<T, F, Self::Response, Out, Req>> where
    Self: Sized,
    T: NewService<Req, InitError = Self::InitError, Error = Self::Error>,
    I: IntoNewService<T, Req>,
    F: Fn(Self::Response, &mut T::Service) -> Out + Clone,
    Out: IntoFuture<Error = Self::Error>, 
[src]

Apply function to specified service and use it as a next service in chain. Read more

fn and_then<F, B>(self, new_service: F) -> AndThenNewService<Self, B> where
    Self: Sized,
    F: IntoNewService<B, Self::Response>,
    B: NewService<Self::Response, Error = Self::Error, InitError = Self::InitError>, 
[src]

Call another service after call to this one has resolved successfully.

fn from_err<E>(self) -> FromErrNewService<Self, E> where
    Self: Sized,
    E: From<Self::Error>, 
[src]

NewService that create service to map this service's error and new service's init error to any error implementing From for this servicesError`. Read more

fn then<F, B>(self, new_service: F) -> ThenNewService<Self, B> where
    Self: Sized,
    F: IntoNewService<B, Result<Self::Response, Self::Error>>,
    B: NewService<Result<Self::Response, Self::Error>, Error = Self::Error, InitError = Self::InitError>, 
[src]

Create NewService to chain on a computation for when a call to the service finished, passing the result of the call to the next service B. Read more

fn map<F, R>(self, f: F) -> MapNewService<Self, F, R> where
    Self: Sized,
    F: Fn(Self::Response) -> R, 
[src]

Map this service's output to a different type, returning a new service of the resulting type. Read more

fn map_err<F, E>(self, f: F) -> MapErrNewService<Self, F, E> where
    Self: Sized,
    F: Fn(Self::Error) -> E, 
[src]

Map this service's error to a different error, returning a new service.

fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, F, E> where
    Self: Sized,
    F: Fn(Self::InitError) -> E, 
[src]

Map this service's init error to a different error, returning a new service.

impl<T, F, In, Out, Request> Clone for ApplyNewService<T, F, In, Out, Request> where
    T: NewService<Request> + Clone,
    F: Fn(In, &mut T::Service) -> Out + Clone,
    Out: IntoFuture
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<T, F, In, Out, Request> Send for ApplyNewService<T, F, In, Out, Request> where
    F: Send,
    In: Send,
    Out: Send,
    Request: Send,
    T: Send

impl<T, F, In, Out, Request> Sync for ApplyNewService<T, F, In, Out, Request> where
    F: Sync,
    In: Sync,
    Out: Sync,
    Request: Sync,
    T: Sync

Blanket Implementations

impl<F, R, E, S, Request> NewService for F where
    F: Fn() -> R,
    R: IntoFuture<Item = S, Error = E>,
    S: Service<Request>, 
[src]

type Response = <S as Service<Request>>::Response

Responses given by the service

type Error = <S as Service<Request>>::Error

Errors produced by the service

type Service = S

The Service value created by this factory

type InitError = E

Errors produced while building a service.

type Future = <R as IntoFuture>::Future

The future of the Service instance.

fn apply<T, I, F, Out, Req>(
    self,
    service: I,
    f: F
) -> AndThenNewService<Self, ApplyNewService<T, F, Self::Response, Out, Req>> where
    Self: Sized,
    T: NewService<Req, InitError = Self::InitError, Error = Self::Error>,
    I: IntoNewService<T, Req>,
    F: Fn(Self::Response, &mut T::Service) -> Out + Clone,
    Out: IntoFuture<Error = Self::Error>, 
[src]

Apply function to specified service and use it as a next service in chain. Read more

fn and_then<F, B>(self, new_service: F) -> AndThenNewService<Self, B> where
    Self: Sized,
    F: IntoNewService<B, Self::Response>,
    B: NewService<Self::Response, Error = Self::Error, InitError = Self::InitError>, 
[src]

Call another service after call to this one has resolved successfully.

fn from_err<E>(self) -> FromErrNewService<Self, E> where
    Self: Sized,
    E: From<Self::Error>, 
[src]

NewService that create service to map this service's error and new service's init error to any error implementing From for this servicesError`. Read more

fn then<F, B>(self, new_service: F) -> ThenNewService<Self, B> where
    Self: Sized,
    F: IntoNewService<B, Result<Self::Response, Self::Error>>,
    B: NewService<Result<Self::Response, Self::Error>, Error = Self::Error, InitError = Self::InitError>, 
[src]

Create NewService to chain on a computation for when a call to the service finished, passing the result of the call to the next service B. Read more

fn map<F, R>(self, f: F) -> MapNewService<Self, F, R> where
    Self: Sized,
    F: Fn(Self::Response) -> R, 
[src]

Map this service's output to a different type, returning a new service of the resulting type. Read more

fn map_err<F, E>(self, f: F) -> MapErrNewService<Self, F, E> where
    Self: Sized,
    F: Fn(Self::Error) -> E, 
[src]

Map this service's error to a different error, returning a new service.

fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, F, E> where
    Self: Sized,
    F: Fn(Self::InitError) -> E, 
[src]

Map this service's init error to a different error, returning a new service.

impl<T, Request> IntoNewService for T where
    T: NewService<Request>, 
[src]

impl<T> From for T
[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

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

type Error = !

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

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.

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