Struct maitake_sync::semaphore::OwnedPermit
source · pub struct OwnedPermit { /* private fields */ }
Available on crate feature
alloc
only.Expand description
An owned RAII guard representing one or more permits acquired from a
Semaphore
.
When the OwnedPermit
is dropped, the permits it represents are
released back to the Semaphore
, potentially waking another task.
This type is identical to the Permit
type, except that it holds an
Arc
clone of the Semaphore
, rather than borrowing it. This
allows the guard to be valid for the 'static
lifetime.
This type is returned by the Semaphore::acquire_owned
and
Semaphore::try_acquire_owned
methods.
Implementations§
source§impl OwnedPermit
impl OwnedPermit
sourcepub 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§
source§impl Debug for OwnedPermit
impl Debug for OwnedPermit
Auto Trait Implementations§
impl Freeze for OwnedPermit
impl !RefUnwindSafe for OwnedPermit
impl Send for OwnedPermit
impl Sync for OwnedPermit
impl Unpin for OwnedPermit
impl !UnwindSafe for OwnedPermit
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