Struct tower_async::make::AsService

source ·
pub struct AsService<'a, M, Request> { /* private fields */ }
Available on crate feature make only.
Expand description

Service returned by MakeService::as_service.

See the documentation on as_service for details.

Trait Implementations§

source§

impl<M, Request> Debug for AsService<'_, M, Request>where M: Debug,

source§

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

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

impl<M, S, Target, Request> Service<Target> for AsService<'_, M, Request>where M: Service<Target, Response = S>, S: Service<Request>,

§

type Response = <M as Service<Target>>::Response

Responses given by the service.
§

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

Errors produced by the service.
source§

async fn call(&mut self, target: Target) -> Result<Self::Response, Self::Error>

Process the request and return the response asynchronously.

Auto Trait Implementations§

§

impl<'a, M, Request> RefUnwindSafe for AsService<'a, M, Request>where M: RefUnwindSafe, Request: RefUnwindSafe,

§

impl<'a, M, Request> Send for AsService<'a, M, Request>where M: Send, Request: Send,

§

impl<'a, M, Request> Sync for AsService<'a, M, Request>where M: Sync, Request: Sync,

§

impl<'a, M, Request> Unpin for AsService<'a, M, Request>where Request: Unpin,

§

impl<'a, M, Request> !UnwindSafe for AsService<'a, M, Request>

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<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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<M, S, Target, Request> MakeService<Target, Request> for Mwhere M: Service<Target, Response = S>, S: Service<Request>,

§

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

Available on crate feature make only.
Responses given by the service
§

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

Available on crate feature make only.
Errors produced by the service
§

type Service = S

Available on crate feature make only.
The Service value created by this factory
§

type MakeError = <M as Service<Target>>::Error

Available on crate feature make only.
Errors produced while building a service.
source§

async fn make_service( &mut self, target: Target ) -> impl Future<Output = Result<<M as MakeService<Target, Request>>::Service, <M as MakeService<Target, Request>>::MakeError>>

Available on crate feature make only.
Create and return a new service value asynchronously.
source§

fn into_service(self) -> IntoService<Self, Request>where Self: Sized,

Available on crate feature make only.
Consume this MakeService and convert it into a Service. Read more
source§

fn as_service(&mut self) -> AsService<'_, Self, Request>where Self: Sized,

Available on crate feature make only.
Convert this MakeService into a Service without consuming the original MakeService. Read more
source§

impl<T, Request> ServiceExt<Request> for Twhere T: Service<Request> + ?Sized,

source§

async fn oneshot(self, req: Request) -> Result<Self::Response, Self::Error>where Self: Sized,

Available on crate feature util only.
Consume this Service, calling it with the provided request once and only once.
source§

fn and_then<F>(self, f: F) -> AndThen<Self, F>where Self: Sized, F: Clone,

Available on crate feature util only.
Executes a new future after this service’s future resolves. Read more
source§

fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where Self: Sized, F: FnOnce(Self::Response) -> Response + Clone,

Available on crate feature util only.
Maps this service’s response value to a different value. Read more
source§

fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where Self: Sized, F: FnOnce(Self::Error) -> Error + Clone,

Available on crate feature util only.
Maps this service’s error value to a different value. Read more
source§

fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where Self: Sized, Error: From<Self::Error>, F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,

Available on crate feature util only.
Maps this service’s result type (Result<Self::Response, Self::Error>) to a different value, regardless of whether the future succeeds or fails. Read more
source§

fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>where Self: Sized, F: FnMut(NewRequest) -> Request,

Available on crate feature util only.
Composes a function in front of the service. Read more
source§

fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>where Self: Sized, F: Predicate<NewRequest>,

Available on crate features util and filter only.
Composes this service with a Filter that conditionally accepts or rejects requests based on a predicate. Read more
source§

fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where Self: Sized, F: AsyncPredicate<NewRequest>,

Available on crate features util and filter only.
Composes this service with an AsyncFilter that conditionally accepts or rejects requests based on an [async predicate]. Read more
source§

fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>where Self: Sized, Error: From<Self::Error>, F: FnOnce(Result<Self::Response, Self::Error>) -> Fut + Clone, Fut: Future<Output = Result<Response, Error>>,

Available on crate feature util only.
Composes an asynchronous function after this service. 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.