pub struct Limiter { /* private fields */ }Expand description
Limit the concurrency of some operation without blocking.
Implementations§
Source§impl Limiter
impl Limiter
Sourcepub fn new(max: NonZeroU32) -> Self
pub fn new(max: NonZeroU32) -> Self
Create a limiter that allows up to max concurrent reservations.
Sourcepub fn try_acquire(&self) -> Option<Reservation>
pub fn try_acquire(&self) -> Option<Reservation>
Attempt to reserve a slot. Returns None when the limiter is saturated.
Auto Trait Implementations§
impl Freeze for Limiter
impl RefUnwindSafe for Limiter
impl Send for Limiter
impl Sync for Limiter
impl Unpin for Limiter
impl UnwindSafe for Limiter
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