Struct tokio_sync::lock::Lock [−][src]
An asynchronous mutual exclusion primitive useful for protecting shared data
Each mutex has a type parameter (T
) which represents the data that it is protecting. The data
can only be accessed through the RAII guards returned from poll_lock
, which guarantees that
the data is only ever accessed when the mutex is locked.
Implementations
impl<T> Lock<T>
[src][−]
pub fn new(t: T) -> Self
[src][−]
Creates a new lock in an unlocked state ready for use.
pub fn poll_lock(&mut self) -> Async<LockGuard<T>>
[src][−]
Try to acquire the lock.
If the lock is already held, the current task is notified when it is released.
Trait Implementations
impl<T> Clone for Lock<T>
[src][+]
impl<T: Debug> Debug for Lock<T>
[src][+]
impl<T> Default for Lock<T> where
T: Default,
[src][+]
T: Default,
impl<T> From<T> for Lock<T>
[src][+]
impl<T> Send for Lock<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Lock<T> where
T: Send,
[src]
T: Send,
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,
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,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,