pub struct PrioritySemaphore { /* private fields */ }
Expand description
Async-aware priority semaphore.
Implementations§
Source§impl PrioritySemaphore
impl PrioritySemaphore
Sourcepub const fn new(permits: usize) -> Self
pub const fn new(permits: usize) -> Self
Create new semaphore with given maximum concurrent permits.
Sourcepub fn acquire(self: &Arc<Self>, prio: Priority) -> AcquireFuture
pub fn acquire(self: &Arc<Self>, prio: Priority) -> AcquireFuture
Async acquire (cancellation-safe).
Sourcepub fn try_acquire(
self: &Arc<Self>,
_prio: Priority,
) -> Result<Permit, TryAcquireError>
pub fn try_acquire( self: &Arc<Self>, _prio: Priority, ) -> Result<Permit, TryAcquireError>
Try immediate acquire.
Sourcepub fn available_permits(&self) -> usize
pub fn available_permits(&self) -> usize
Number of currently available permits.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PrioritySemaphore
impl RefUnwindSafe for PrioritySemaphore
impl Send for PrioritySemaphore
impl Sync for PrioritySemaphore
impl Unpin for PrioritySemaphore
impl UnwindSafe for PrioritySemaphore
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