pub struct OneRequestService<S> { /* private fields */ }Expand description
Service wrapper that allows only one call to run at a time.
This type is intentionally not cloneable. Cloning its readiness state would create another independent gate and allow calls to overlap.
Acquiring or releasing the call slot invalidates this service’s readiness. The wrapped service has an independent readiness cache and must notify when its readiness changes.
Implementations§
Trait Implementations§
Source§impl<S: Debug> Debug for OneRequestService<S>
impl<S: Debug> Debug for OneRequestService<S>
Source§impl<S: Service<St, Req>, St, Req> Service<St, Req> for OneRequestService<S>
impl<S: Service<St, Req>, St, Req> Service<St, Req> for OneRequestService<S>
Source§type Error = <S as Service<St, Req>>::Error
type Error = <S as Service<St, Req>>::Error
Error produced while checking readiness or processing a request.
Source§async fn ready(&self, ctx: Ctx<'_, Self, St>) -> Result<(), S::Error>
async fn ready(&self, ctx: Ctx<'_, Self, St>) -> Result<(), S::Error>
Waits until the service is ready to process a request. Read more
Source§async fn call(
&self,
req: Req,
ctx: Ctx<'_, Self, St>,
) -> Result<S::Res, S::Error>
async fn call( &self, req: Req, ctx: Ctx<'_, Self, St>, ) -> Result<S::Res, S::Error>
Processes a request and asynchronously returns the response. Read more
Source§fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
Maps this service’s output to a different type, returning a new service. Read more
Source§fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
Maps this service’s error to a different type, returning a new service. Read more
Auto Trait Implementations§
impl<S> !Freeze for OneRequestService<S>
impl<S> !RefUnwindSafe for OneRequestService<S>
impl<S> !Send for OneRequestService<S>
impl<S> !Sync for OneRequestService<S>
impl<S> !UnwindSafe for OneRequestService<S>
impl<S> Unpin for OneRequestService<S>where
ServiceBinding<S>: Unpin,
impl<S> UnsafeUnpin for OneRequestService<S>where
ServiceBinding<S>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S, St, Req> IntoService<S, St, Req> for Swhere
S: Service<St, Req>,
impl<S, St, Req> IntoService<S, St, Req> for Swhere
S: Service<St, Req>,
Source§fn into_service(self) -> S
fn into_service(self) -> S
Converts this value into a service.