pub struct Semaphore { /* private fields */ }
Expand description
Futures-aware semaphore.
Implementations§
Source§impl Semaphore
impl Semaphore
Sourcepub fn available_permits(&self) -> usize
pub fn available_permits(&self) -> usize
Returns the current number of available permits
Sourcepub fn close(&self)
pub fn close(&self)
Close the semaphore. This prevents the semaphore from issuing new permits and notifies all pending waiters.
Sourcepub fn add_permits(&self, n: usize)
pub fn add_permits(&self, n: usize)
Add n
new permits to the semaphore.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Semaphore
impl !RefUnwindSafe for Semaphore
impl Unpin for Semaphore
impl !UnwindSafe for Semaphore
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