[−][src]Struct async_lock::Lock
An async lock.
Implementations
impl<T> Lock<T>
[src]
pub fn new(data: T) -> Lock<T>
[src]
pub async fn lock<'_>(&'_ self) -> LockGuard<T>
[src]
Acquires the lock.
Returns a guard that releases the lock when dropped.
Examples
use async_lock::Lock; let lock = Lock::new(10); let guard = lock.lock().await; assert_eq!(*guard, 10);
pub async fn lock_slow<'_>(&'_ self) -> LockGuard<T>
[src]
Slow path for acquiring the lock.
pub fn try_lock(&self) -> Option<LockGuard<T>>
[src]
Trait Implementations
impl<T> Clone for Lock<T>
[src]
impl<T: Debug> Debug for Lock<T>
[src]
impl<T: Default> Default for Lock<T>
[src]
impl<T> From<T> for Lock<T>
[src]
impl<T: Send> Send for Lock<T>
[src]
impl<T: Send> Sync for Lock<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,