pub struct MapResponse<S, F> { /* private fields */ }
Expand description

map_response返回的服务。

Implementations§

source§

impl<S, F> MapResponse<S, F>

source

pub fn new(service: S, f: F) -> Self

创建一个新的MapResponse服务。

Trait Implementations§

source§

impl<S: Clone, F: Clone> Clone for MapResponse<S, F>

source§

fn clone(&self) -> MapResponse<S, F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S, F> Debug for MapResponse<S, F>
where S: Debug,

source§

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

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

impl<S, F, Req, Res> Service<Req> for MapResponse<S, F>
where S: Service<Req>, F: Fn(S::Response) -> Res + Send + Sync,

§

type Response = Res

服务返回的响应。
§

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

服务产生的错误。
source§

fn call( &self, req: Req ) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send

处理请求并异步返回响应。
source§

impl<S: Copy, F: Copy> Copy for MapResponse<S, F>

Auto Trait Implementations§

§

impl<S, F> Freeze for MapResponse<S, F>
where S: Freeze, F: Freeze,

§

impl<S, F> RefUnwindSafe for MapResponse<S, F>

§

impl<S, F> Send for MapResponse<S, F>
where S: Send, F: Send,

§

impl<S, F> Sync for MapResponse<S, F>
where S: Sync, F: Sync,

§

impl<S, F> Unpin for MapResponse<S, F>
where S: Unpin, F: Unpin,

§

impl<S, F> UnwindSafe for MapResponse<S, F>
where S: UnwindSafe, F: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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<S, Req> ServiceExt<Req> for S
where S: Service<Req> + ?Sized,

source§

fn with<T>(self, middleware: T) -> T::Service
where Self: Sized, T: Middleware<Self>,

在此服务上应用中间件。 Read more
source§

fn then<F, Fut, Res, Err>(self, f: F) -> Then<Self, F>
where Self: Sized, F: Fn(Result<Self::Response, Self::Error>) -> Fut + Send + Sync, Fut: Future<Output = Result<Res, Err>> + Send,

在此服务执行完成后执行给定的异步函数。 Read more
source§

fn and_then<F, Fut, Res>(self, f: F) -> AndThen<Self, F>
where Self: Sized, F: Fn(Self::Response) -> Fut + Send + Sync, Fut: Future<Output = Result<Res, Self::Error>> + Send,

在此服务执行成功后执行给定的异步函数。 Read more
source§

fn or_else<F, Fut, Err>(self, f: F) -> OrElse<Self, F>
where Self: Sized, F: Fn(Self::Error) -> Fut + Send + Sync, Fut: Future<Output = Result<Self::Response, Err>> + Send,

在此服务执行失败后执行给定的异步函数。 Read more
source§

fn map_result<F, Res, Err>(self, f: F) -> MapResult<Self, F>
where Self: Sized, F: Fn(Result<Self::Response, Self::Error>) -> Result<Res, Err> + Send + Sync,

将此服务返回的结果映射为其他值。 Read more
source§

fn map_response<F, Res>(self, f: F) -> MapResponse<Self, F>
where Self: Sized, F: Fn(Self::Response) -> Res + Send + Sync,

将此服务返回的响应映射为其他值。 Read more
source§

fn map_err<F, Err>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: Fn(Self::Error) -> Err + Send + Sync,

将此服务返回的错误映射为其他值。 Read more
source§

fn map_request<F, R>(self, f: F) -> MapRequest<Self, F>
where Self: Sized, F: Fn(R) -> Req + Send + Sync,

将发送给此服务的请求映射为其他值。 Read more
source§

fn boxed(self) -> BoxService<Req, Self::Response, Self::Error>
where Self: Sized + 'static,

将此服务转换为Service特征对象并装箱。 Read more
source§

fn boxed_clone(self) -> BoxCloneService<Req, Self::Response, Self::Error>
where Self: Sized + Clone + 'static,

将此服务转换为Service特征对象并装箱。 Read more
source§

fn boxed_arc(self) -> ArcService<Req, Self::Response, Self::Error>
where Self: Sized + 'static,

将此服务转换为Service特征对象并装箱。 Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.