pub struct Semaphore { /* private fields */ }
Expand description
An asynchronous semaphore.
Implementations§
source§impl Semaphore
impl Semaphore
sourcepub fn try_acquire(&self) -> Option<SemaphoreGuard<'_>>
pub fn try_acquire(&self) -> Option<SemaphoreGuard<'_>>
Try to acquire a permit.
sourcepub fn try_acquire_rc(self: Rc<Self>) -> Option<SemaphoreGuardRc>
Available on crate feature alloc
only.
pub fn try_acquire_rc(self: Rc<Self>) -> Option<SemaphoreGuardRc>
alloc
only.Try to acquire a permit through an Rc
.
sourcepub async fn acquire(&self) -> SemaphoreGuard<'_>
pub async fn acquire(&self) -> SemaphoreGuard<'_>
Acquire a permit.
sourcepub async fn acquire_rc(self: Rc<Self>) -> SemaphoreGuardRc
Available on crate feature alloc
only.
pub async fn acquire_rc(self: Rc<Self>) -> SemaphoreGuardRc
alloc
only.Acquire a permit through an Rc
.
Auto Trait Implementations§
impl !RefUnwindSafe for Semaphore
impl !Send for Semaphore
impl !Sync for Semaphore
impl Unpin for Semaphore
impl !UnwindSafe for Semaphore
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