pub struct OwnedPermit { /* private fields */ }
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