pub struct GreedySemaphore<M: RawMutex> { /* private fields */ }
Expand description
A greedy Semaphore
implementation.
Tasks can acquire permits as soon as they become available, even if another task is waiting on a larger number of permits.
Implementations§
Trait Implementations§
Source§impl<M: RawMutex> Default for GreedySemaphore<M>
impl<M: RawMutex> Default for GreedySemaphore<M>
Source§impl<M: RawMutex> Semaphore for GreedySemaphore<M>
impl<M: RawMutex> Semaphore for GreedySemaphore<M>
Source§type Error = Infallible
type Error = Infallible
The error returned when the semaphore is unable to acquire the requested permits.
Source§async fn acquire(
&self,
permits: usize,
) -> Result<SemaphoreReleaser<'_, Self>, Self::Error>
async fn acquire( &self, permits: usize, ) -> Result<SemaphoreReleaser<'_, Self>, Self::Error>
Asynchronously acquire one or more permits from the semaphore.
Source§fn try_acquire(&self, permits: usize) -> Option<SemaphoreReleaser<'_, Self>>
fn try_acquire(&self, permits: usize) -> Option<SemaphoreReleaser<'_, Self>>
Try to immediately acquire one or more permits from the semaphore.
Source§async fn acquire_all(
&self,
min: usize,
) -> Result<SemaphoreReleaser<'_, Self>, Self::Error>
async fn acquire_all( &self, min: usize, ) -> Result<SemaphoreReleaser<'_, Self>, Self::Error>
Asynchronously acquire all permits controlled by the semaphore. Read more
Source§fn try_acquire_all(&self, min: usize) -> Option<SemaphoreReleaser<'_, Self>>
fn try_acquire_all(&self, min: usize) -> Option<SemaphoreReleaser<'_, Self>>
Try to immediately acquire all available permits from the semaphore, if at least
min
permits are available.Auto Trait Implementations§
impl<M> !Freeze for GreedySemaphore<M>
impl<M> !RefUnwindSafe for GreedySemaphore<M>
impl<M> Send for GreedySemaphore<M>where
M: Send,
impl<M> Sync for GreedySemaphore<M>where
M: Sync,
impl<M> Unpin for GreedySemaphore<M>where
M: Unpin,
impl<M> UnwindSafe for GreedySemaphore<M>where
M: UnwindSafe,
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