pub struct Permit<'sem> { /* private fields */ }
Expand description
A RAII guard representing one or more permits acquired from a
Semaphore
.
When the Permit
is dropped, the permits it represents are released back to
the Semaphore
, potentially waking another task.
This type is returned by the Semaphore::acquire
and
Semaphore::try_acquire
methods.
Implementations§
§impl Permit<'_>
impl Permit<'_>
pub fn forget(self)
pub fn forget(self)
Forget this permit, dropping it without returning the number of acquired permits to the semaphore.
This permanently decreases the number of permits in the semaphore by
self.permits()
.
Trait Implementations§
Auto Trait Implementations§
impl<'sem> !RefUnwindSafe for Permit<'sem>
impl<'sem> Send for Permit<'sem>
impl<'sem> Sync for Permit<'sem>
impl<'sem> Unpin for Permit<'sem>
impl<'sem> !UnwindSafe for Permit<'sem>
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