pub struct OwnedPermit<S, C = Uncloseable>{ /* private fields */ }Expand description
The drop-guard for owned semaphore permits. Will ensure the permit is released when dropped.
Implementations§
Source§impl<S, C> OwnedPermit<S, C>
impl<S, C> OwnedPermit<S, C>
Sourcepub fn out_of_thin_air(sem: Arc<Semaphore<S, C>>, permit: S::Permit) -> Self
pub fn out_of_thin_air(sem: Arc<Semaphore<S, C>>, permit: S::Permit) -> Self
Construct a new permit out of thin air, no waiting is required.
This can violate the purpose of the semaphore, but is provided for convenience.
It can be used to introduce new permits to the semaphore if desired, or it can be
paired with Permit::take for niche use-cases where the semaphore lifetime
gets in the way.
Trait Implementations§
Source§impl<S, C> Debug for OwnedPermit<S, C>
impl<S, C> Debug for OwnedPermit<S, C>
Source§impl<S, C> Deref for OwnedPermit<S, C>
impl<S, C> Deref for OwnedPermit<S, C>
Source§impl<S, C> DerefMut for OwnedPermit<S, C>
impl<S, C> DerefMut for OwnedPermit<S, C>
Auto Trait Implementations§
impl<S, C> Freeze for OwnedPermit<S, C>
impl<S, C = Uncloseable> !RefUnwindSafe for OwnedPermit<S, C>
impl<S, C> Send for OwnedPermit<S, C>where
<S as SemaphoreState>::Permit: Send,
S: Send + ?Sized,
<C as Sealed>::Closed<()>: Send,
<C as Sealed>::Closed<Option<<S as SemaphoreState>::Params>>: Send,
<S as SemaphoreState>::Params: Send,
impl<S, C> Sync for OwnedPermit<S, C>where
<S as SemaphoreState>::Permit: Sync + Send,
S: Send + ?Sized,
<C as Sealed>::Closed<()>: Send,
<C as Sealed>::Closed<Option<<S as SemaphoreState>::Params>>: Send,
<S as SemaphoreState>::Params: Send,
impl<S, C> Unpin for OwnedPermit<S, C>
impl<S, C = Uncloseable> !UnwindSafe for OwnedPermit<S, C>
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