Struct embassy_sync::semaphore::GreedySemaphore
source · 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>
§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.