Struct tokio_sync::semaphore::Semaphore
source · [−]pub struct Semaphore { /* private fields */ }
Expand description
Futures-aware semaphore.
Implementations
sourceimpl 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
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more