pub struct BoxCloneService<Req, Res, Err> { /* private fields */ }
Expand description

装箱的Service特征对象。

BoxCloneService将服务转换为特征对象并装箱,允许服务的Future是动态的, 并允许克隆服务。

这与BoxService类似,只是BoxCloneService实现了Clone

Implementations§

source§

impl<Req, Res, Err> BoxCloneService<Req, Res, Err>

source

pub fn new<S>(service: S) -> Self
where S: Service<Req, Response = Res, Error = Err> + Clone + 'static,

将服务转换为Service特征对象并装箱。

Trait Implementations§

source§

impl<Req, Res, Err> Clone for BoxCloneService<Req, Res, Err>

source§

fn clone(&self) -> Self

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<Req, Res, Err> Debug for BoxCloneService<Req, Res, Err>

source§

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

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

impl<Req, Res, Err> Service<Req> for BoxCloneService<Req, Res, Err>

§

type Response = Res

服务返回的响应。
§

type Error = Err

服务产生的错误。
source§

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

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

Auto Trait Implementations§

§

impl<Req, Res, Err> Freeze for BoxCloneService<Req, Res, Err>

§

impl<Req, Res, Err> !RefUnwindSafe for BoxCloneService<Req, Res, Err>

§

impl<Req, Res, Err> Send for BoxCloneService<Req, Res, Err>

§

impl<Req, Res, Err> Sync for BoxCloneService<Req, Res, Err>

§

impl<Req, Res, Err> Unpin for BoxCloneService<Req, Res, Err>

§

impl<Req, Res, Err> !UnwindSafe for BoxCloneService<Req, Res, Err>

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.