pub struct GenericSemaphoreReleaser<'a, MutexType: RawMutex> { /* private fields */ }
Expand description
An RAII guard returned by the acquire
and try_acquire
methods.
When this structure is dropped (falls out of scope),
the amount of permits that was used in the acquire()
call will be released
back to the Semaphore.
Implementations§
Source§impl<MutexType: RawMutex> GenericSemaphoreReleaser<'_, MutexType>
impl<MutexType: RawMutex> GenericSemaphoreReleaser<'_, MutexType>
Sourcepub fn disarm(&mut self) -> usize
pub fn disarm(&mut self) -> usize
Prevents the SemaphoreReleaser from automatically releasing the permits when it gets dropped. This is helpful if the permits must be acquired for a longer lifetime than the one of the SemaphoreReleaser. If this method is used it is important to release the acquired permits manually back to the Semaphore.
Trait Implementations§
Source§impl<MutexType: RawMutex> Debug for GenericSemaphoreReleaser<'_, MutexType>
impl<MutexType: RawMutex> Debug for GenericSemaphoreReleaser<'_, MutexType>
Auto Trait Implementations§
impl<'a, MutexType> Freeze for GenericSemaphoreReleaser<'a, MutexType>
impl<'a, MutexType> !RefUnwindSafe for GenericSemaphoreReleaser<'a, MutexType>
impl<'a, MutexType> Send for GenericSemaphoreReleaser<'a, MutexType>where
MutexType: Sync,
impl<'a, MutexType> Sync for GenericSemaphoreReleaser<'a, MutexType>where
MutexType: Sync,
impl<'a, MutexType> Unpin for GenericSemaphoreReleaser<'a, MutexType>
impl<'a, MutexType> !UnwindSafe for GenericSemaphoreReleaser<'a, MutexType>
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