pub struct OwnedSemaphorePermit { /* private fields */ }Expand description
Permits taken from a Semaphore held through an Arc. The release
makes the progress SemaphorePermit’s does.
Implementations§
Source§impl OwnedSemaphorePermit
impl OwnedSemaphorePermit
Sourcepub fn merge(&mut self, other: Self)
pub fn merge(&mut self, other: Self)
Merges other into this permit, so one drop returns both.
§Panics
When the permits come from different semaphores, or their total
overflows usize.
Sourcepub fn split(&mut self, n: usize) -> Option<Self>
pub fn split(&mut self, n: usize) -> Option<Self>
Splits n permits off this one, or returns None when it holds
fewer than n.
Sourcepub fn num_permits(&self) -> usize
pub fn num_permits(&self) -> usize
How many permits this holds.
Sourcepub fn count(&self) -> usize
pub fn count(&self) -> usize
How many permits this holds; the same as
num_permits.
Trait Implementations§
Source§impl Debug for OwnedSemaphorePermit
impl Debug for OwnedSemaphorePermit
Source§impl Drop for OwnedSemaphorePermit
impl Drop for OwnedSemaphorePermit
Auto Trait Implementations§
impl !RefUnwindSafe for OwnedSemaphorePermit
impl !UnwindSafe for OwnedSemaphorePermit
impl Freeze for OwnedSemaphorePermit
impl Send for OwnedSemaphorePermit
impl Sync for OwnedSemaphorePermit
impl Unpin for OwnedSemaphorePermit
impl UnsafeUnpin for OwnedSemaphorePermit
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