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§
Source§impl<S> OneRequestService<S>
impl<S> OneRequestService<S>
Sourcepub fn new<St, Req>(service: S) -> OneRequestService<S>where
S: Service<St, Req>,
pub fn new<St, Req>(service: S) -> OneRequestService<S>where
S: Service<St, Req>,
Wraps a service so that concurrent callers wait for the active call.
Trait Implementations§
Source§impl<S> Debug for OneRequestService<S>where
S: Debug,
impl<S> Debug for OneRequestService<S>where
S: Debug,
Source§impl<S, St, Req> Service<St, Req> for OneRequestService<S>where
S: Service<St, Req>,
impl<S, St, Req> Service<St, Req> for OneRequestService<S>where
S: Service<St, Req>,
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<'_, OneRequestService<S>, St>,
) -> Result<(), <S as Service<St, Req>>::Error>
async fn ready( &self, ctx: Ctx<'_, OneRequestService<S>, St>, ) -> Result<(), <S as Service<St, Req>>::Error>
Waits until the service is ready to process a request. Read more
Source§async fn call(
&self,
req: Req,
ctx: Ctx<'_, OneRequestService<S>, St>,
) -> Result<<S as Service<St, Req>>::Res, <S as Service<St, Req>>::Error>
async fn call( &self, req: Req, ctx: Ctx<'_, OneRequestService<S>, St>, ) -> Result<<S as Service<St, Req>>::Res, <S as Service<St, Req>>::Error>
Processes a request and asynchronously returns the response. Read more
Source§async fn shutdown(&self, ctx: Ctx<'_, OneRequestService<S>, St>)
async fn shutdown(&self, ctx: Ctx<'_, OneRequestService<S>, St>)
Shuts down the service. 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
S: Unpin,
impl<S> UnsafeUnpin for OneRequestService<S>where
S: UnsafeUnpin,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.