pub struct ConcurrentPolicy<B> { /* private fields */ }
Available on crate feature
limit
only.Expand description
A policy that limits the number of concurrent requests.
Implementations§
Source§impl ConcurrentPolicy<()>
impl ConcurrentPolicy<()>
Source§impl<B> ConcurrentPolicy<B>
impl<B> ConcurrentPolicy<B>
Sourcepub fn with_backoff(max: usize, backoff: B) -> Self
pub fn with_backoff(max: usize, backoff: B) -> Self
Create a new concurrent policy, which backs off if the limit is reached, using the given backoff policy.
Trait Implementations§
Source§impl<B> Clone for ConcurrentPolicy<B>where
B: Clone,
impl<B> Clone for ConcurrentPolicy<B>where
B: Clone,
Source§impl<B: Debug> Debug for ConcurrentPolicy<B>
impl<B: Debug> Debug for ConcurrentPolicy<B>
Source§impl<Request> Policy<Request> for ConcurrentPolicy<()>
impl<Request> Policy<Request> for ConcurrentPolicy<()>
Source§type Guard = ConcurrentGuard
type Guard = ConcurrentGuard
The guard type that is returned when the request is allowed to proceed. Read more
Source§type Error = LimitReached
type Error = LimitReached
The error type that is returned when the request is not allowed to proceed,
and should be aborted. Read more
Source§async fn check(&self, _: &mut Request) -> PolicyOutput<Self::Guard, Self::Error>
async fn check(&self, _: &mut Request) -> PolicyOutput<Self::Guard, Self::Error>
Check whether the request is allowed to proceed. Read more
Source§impl<B, Request> Policy<Request> for ConcurrentPolicy<B>where
B: Backoff,
impl<B, Request> Policy<Request> for ConcurrentPolicy<B>where
B: Backoff,
Source§type Guard = ConcurrentGuard
type Guard = ConcurrentGuard
The guard type that is returned when the request is allowed to proceed. Read more
Source§type Error = Infallible
type Error = Infallible
The error type that is returned when the request is not allowed to proceed,
and should be aborted. Read more
Source§async fn check(&self, _: &mut Request) -> PolicyOutput<Self::Guard, Self::Error>
async fn check(&self, _: &mut Request) -> PolicyOutput<Self::Guard, Self::Error>
Check whether the request is allowed to proceed. Read more
Auto Trait Implementations§
impl<B> Freeze for ConcurrentPolicy<B>where
B: Freeze,
impl<B> RefUnwindSafe for ConcurrentPolicy<B>where
B: RefUnwindSafe,
impl<B> Send for ConcurrentPolicy<B>where
B: Send,
impl<B> Sync for ConcurrentPolicy<B>where
B: Sync,
impl<B> Unpin for ConcurrentPolicy<B>where
B: Unpin,
impl<B> UnwindSafe for ConcurrentPolicy<B>where
B: UnwindSafe,
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