Struct BoxCloneService
struct BoxCloneService<T, U, E>(_)
BoxCloneService turns a service into a trait object, allowing the
response future type to be dynamic, and allowing the service to be cloned.
This is similar to BoxService except the resulting
service implements Clone.
Example
use ;
use Duration;
#
# ;
# ;
#
// This service has a complex type that is hard to name
let service = new
.map_request
.map_response
.load_shed
.concurrency_limit
.timeout
.service_fn;
# let service = assert_service;
// `BoxCloneService` will erase the type so it's nameable
let service: = new;
# let service = assert_service;
// And we can still clone the service
let cloned_service = service.clone;
#
# # where S:
Implementations
impl<T, U, E> BoxCloneService<T, U, E>
fn new<S>(inner: S) -> Self where S: Service<T, Response = U, Error = E> + Clone + Send + 'static, <S as >::Future: Send + 'staticCreate a new
BoxCloneService.fn layer<S>() -> LayerFn<fn(_: S) -> Self> where S: Service<T, Response = U, Error = E> + Clone + Send + 'static, <S as >::Future: Send + 'staticReturns a
Layerfor wrapping aServicein aBoxCloneServicemiddleware.
impl<M, S, Target, Request> MakeService for BoxCloneService<T, U, E>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>fn make_service(self: &mut Self, target: Target) -> <M as MakeService<Target, Request>>::Future
impl<T> Any for BoxCloneService<T, U, E>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for BoxCloneService<T, U, E>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for BoxCloneService<T, U, E>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for BoxCloneService<T, U, E>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for BoxCloneService<T, U, E>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for BoxCloneService<T, U, E>
impl<T> ToOwned for BoxCloneService<T, U, E>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> WithSubscriber for BoxCloneService<T, U, E>
impl<T, Request> ServiceExt for BoxCloneService<T, U, E>
impl<T, U> Into for BoxCloneService<T, U, E>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for BoxCloneService<T, U, E>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for BoxCloneService<T, U, E>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T, U, E> Clone for BoxCloneService<T, U, E>
fn clone(self: &Self) -> Self
impl<T, U, E> Debug for BoxCloneService<T, U, E>
fn fmt(self: &Self, fmt: &mut Formatter<'_>) -> Result
impl<T, U, E> Freeze for BoxCloneService<T, U, E>
impl<T, U, E> RefUnwindSafe for BoxCloneService<T, U, E>
impl<T, U, E> Send for BoxCloneService<T, U, E>
impl<T, U, E> Service for BoxCloneService<T, U, E>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), E>>fn call(self: &mut Self, request: T) -> <Self as >::Future