pub struct SemaphorePermit<'a> { /* private fields */ }
Expand description
A permit from the semaphore.
This type is created by the acquire
method.
Implementations§
§impl<'a> SemaphorePermit<'a>
impl<'a> SemaphorePermit<'a>
pub fn forget(self)
pub fn forget(self)
Forgets the permit without releasing it back to the semaphore. This can be used to reduce the amount of permits available from a semaphore.
pub fn merge(&mut self, other: SemaphorePermit<'a>)
pub fn merge(&mut self, other: SemaphorePermit<'a>)
Merge two SemaphorePermit
instances together, consuming other
without releasing the permits it holds.
Permits held by both self
and other
are released when self
drops.
§Panics
This function panics if permits from different Semaphore
instances
are merged.
Trait Implementations§
§impl<'a> Debug for SemaphorePermit<'a>
impl<'a> Debug for SemaphorePermit<'a>
Auto Trait Implementations§
impl<'a> Freeze for SemaphorePermit<'a>
impl<'a> !RefUnwindSafe for SemaphorePermit<'a>
impl<'a> Send for SemaphorePermit<'a>
impl<'a> Sync for SemaphorePermit<'a>
impl<'a> Unpin for SemaphorePermit<'a>
impl<'a> !UnwindSafe for SemaphorePermit<'a>
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