Struct BoxCloneService

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

装箱的Service特征对象。

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

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

Implementations§

Source§

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

Source

pub fn new<S>(inner: S) -> BoxCloneService<Req, Res, Err>
where S: Service<Req, Response = Res, Error = Err> + Clone + 'static, <S as Service<Req>>::Future: 'static,

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> BoxCloneService<Req, Res, Err>

Returns a duplicate 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, fmt: &mut Formatter<'_>) -> Result<(), Error>

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

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

Source§

type Response = Res

服务返回的响应。
Source§

type Error = Err

服务产生的错误。
Source§

type Future = Pin<Box<dyn Future<Output = Result<Res, Err>>>>

异步返回的响应。
Source§

fn call(&self, request: Req) -> Pin<Box<dyn Future<Output = Result<Res, Err>>>>

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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>,

Source§

fn with<T>(self, wrap: T) -> <T as Wrap<Self>>::Service
where Self: Sized, T: Wrap<Self>,

Source§

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

Source§

fn then<F>(self, f: F) -> Then<Self, F>
where Self: Sized,

Source§

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

Source§

fn map_future<F>(self, f: F) -> MapFuture<Self, F>
where Self: Sized,

Source§

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

Source§

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

Source§

fn map_result<F>(self, f: F) -> MapResult<Self, F>
where Self: Sized,

Source§

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

Source§

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

Source§

fn rc_boxed(self) -> RcService<Req, Self::Response, Self::Error>
where Self: Sized + 'static, Self::Future: 'static,

Source§

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

Source§

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>,

Source§

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>,

Source§

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.