pub struct SemaphorePermit<'a, P: Priority, Q: SemaphoreQueue<P>>(/* private fields */);Expand description
A permit (or collection of permits) from a Semaphore
Acquired via Semaphore::acquire and associated fns.
Implementations§
Source§impl<'a, P: Priority, Q: SemaphoreQueue<P>> SemaphorePermit<'a, P, Q>
impl<'a, P: Priority, Q: SemaphoreQueue<P>> SemaphorePermit<'a, P, Q>
Sourcepub fn evicted(&mut self) -> impl Future<Output = ()>
pub fn evicted(&mut self) -> impl Future<Output = ()>
Returns a future which resolves when / if a higher priority requester is waiting for permit
acquisition. Available only if the evict flag is enabled.
Cancel Safety: This function is cancel safe.
Sourcepub fn belongs_to(&self, semaphore: &Semaphore<P, Q>) -> bool
pub fn belongs_to(&self, semaphore: &Semaphore<P, Q>) -> bool
Checks if self belongs to semaphore.
Sourcepub fn split(&mut self, count: usize) -> Result<Self, InsufficientPermitsError>where
P: Clone,
pub fn split(&mut self, count: usize) -> Result<Self, InsufficientPermitsError>where
P: Clone,
Split into multiple permit guards / holder. The new guard will have the same priority for evictions.
P must implement Clone for this to succeed. If P is not Clone,
split_with_priority may be used instead.
pub fn split_with_priority( &mut self, count: usize, priority: P, ) -> Result<Self, InsufficientPermitsError>
Trait Implementations§
Source§impl<'a, P: Priority, Q: SemaphoreQueue<P>> Debug for SemaphorePermit<'a, P, Q>
impl<'a, P: Priority, Q: SemaphoreQueue<P>> Debug for SemaphorePermit<'a, P, Q>
Source§impl<'a, P: Priority, Q: SemaphoreQueue<P>> Drop for SemaphorePermit<'a, P, Q>
impl<'a, P: Priority, Q: SemaphoreQueue<P>> Drop for SemaphorePermit<'a, P, Q>
impl<'a, P: Priority, Q: SemaphoreQueue<P>> Send for SemaphorePermit<'a, P, Q>
impl<'a, P: Priority, Q: SemaphoreQueue<P>> Sync for SemaphorePermit<'a, P, Q>
Auto Trait Implementations§
impl<'a, P, Q> Freeze for SemaphorePermit<'a, P, Q>
impl<'a, P, Q> RefUnwindSafe for SemaphorePermit<'a, P, Q>
impl<'a, P, Q> Unpin for SemaphorePermit<'a, P, Q>
impl<'a, P, Q> UnsafeUnpin for SemaphorePermit<'a, P, Q>
impl<'a, P, Q> UnwindSafe for SemaphorePermit<'a, P, Q>
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