pub struct InFlight<T> { /* private fields */ }
Expand description
InFlight - new service for service that can limit number of in-flight async requests.
Default number of in-flight requests is 15
Implementations§
source§impl<T> InFlight<T>where
T: NewService,
impl<T> InFlight<T>where
T: NewService,
pub fn new<F: IntoNewService<T>>(factory: F) -> Self
sourcepub fn max_inflight(self, max: usize) -> Self
pub fn max_inflight(self, max: usize) -> Self
Set max number of in-flight requests.
By default max in-flight requests is 15.
Trait Implementations§
source§impl<T> NewService for InFlight<T>where
T: NewService,
impl<T> NewService for InFlight<T>where
T: NewService,
§type Request = <T as NewService>::Request
type Request = <T as NewService>::Request
Requests handled by the service
§type Response = <T as NewService>::Response
type Response = <T as NewService>::Response
Responses given by the service
§type Error = <T as NewService>::Error
type Error = <T as NewService>::Error
Errors produced by the service
§type InitError = <T as NewService>::InitError
type InitError = <T as NewService>::InitError
Errors produced while building a service.
§type Service = InFlightService<<T as NewService>::Service>
type Service = InFlightService<<T as NewService>::Service>
The
Service
value created by this factory§type Future = InFlightResponseFuture<T>
type Future = InFlightResponseFuture<T>
The future of the
Service
instance.source§fn new_service(&self) -> Self::Future
fn new_service(&self) -> Self::Future
Create and return a new service value asynchronously.
Auto Trait Implementations§
impl<T> RefUnwindSafe for InFlight<T>where
T: RefUnwindSafe,
impl<T> Send for InFlight<T>where
T: Send,
impl<T> Sync for InFlight<T>where
T: Sync,
impl<T> Unpin for InFlight<T>where
T: Unpin,
impl<T> UnwindSafe for InFlight<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> IntoNewService<T> for Twhere
T: NewService,
impl<T> IntoNewService<T> for Twhere
T: NewService,
source§fn into_new_service(self) -> T
fn into_new_service(self) -> T
Convert to an
NewService
source§impl<T> NewServiceExt for Twhere
T: NewService + ?Sized,
impl<T> NewServiceExt for Twhere
T: NewService + ?Sized,
fn apply<S, I, F, R>(
self,
service: I,
f: F
) -> AndThenNewService<Self, ApplyNewService<S, F, R, Self::Response>>where
Self: Sized,
S: NewService<InitError = Self::InitError>,
S::Error: Into<<R::Future as Future>::Error>,
I: IntoNewService<S>,
F: Fn(Self::Response, &mut S::Service) -> R + Clone,
R: IntoFuture<Error = Self::Error>,
fn and_then<F, B>(self, new_service: F) -> AndThenNewService<Self, B>where
Self: Sized,
F: IntoNewService<B>,
B: NewService<Request = Self::Response, Error = Self::Error, InitError = Self::InitError>,
source§fn from_err<E>(self) -> FromErrNewService<Self, E>where
Self: Sized,
E: From<Self::Error>,
fn from_err<E>(self) -> FromErrNewService<Self, E>where
Self: Sized,
E: From<Self::Error>,
NewService
that create service to map this service’s error
and new service’s init error to any error
implementing From
for this services
Error`. Read moresource§fn then<F, B>(self, new_service: F) -> ThenNewService<Self, B>where
Self: Sized,
F: IntoNewService<B>,
B: NewService<Request = Result<Self::Response, Self::Error>, Error = Self::Error, InitError = Self::InitError>,
fn then<F, B>(self, new_service: F) -> ThenNewService<Self, B>where
Self: Sized,
F: IntoNewService<B>,
B: NewService<Request = Result<Self::Response, Self::Error>, Error = Self::Error, InitError = Self::InitError>,
Create
NewService
to chain on a computation for when a call to the
service finished, passing the result of the call to the next
service B
. Read more