[−][src]Struct fast_async_mutex::rwlock::RwLock
The RW Lock mechanism accepts you get concurrent shared access to your data without waiting. And get unique access with locks like a Mutex.
Implementations
impl<T> RwLock<T>
[src]
impl<T: ?Sized> RwLock<T>
[src]
pub fn write(&self) -> RwLockWriteGuardFuture<'_, T>ⓘNotable traits for RwLockWriteGuardFuture<'a, T>
impl<'a, T: ?Sized> Future for RwLockWriteGuardFuture<'a, T> type Output = RwLockWriteGuard<'a, T>;
[src]
Notable traits for RwLockWriteGuardFuture<'a, T>
impl<'a, T: ?Sized> Future for RwLockWriteGuardFuture<'a, T> type Output = RwLockWriteGuard<'a, T>;
Acquires the mutex for are write.
Returns a guard that releases the mutex and wake the next locker when it will be dropped.
Examples
use fast_async_mutex::rwlock::RwLock; #[tokio::main] async fn main() { let mutex = RwLock::new(10); let mut guard = mutex.write().await; *guard += 1; assert_eq!(*guard, 11); }
pub fn write_owned(self: &Arc<Self>) -> RwLockWriteOwnedGuardFuture<T>ⓘNotable traits for RwLockWriteOwnedGuardFuture<T>
impl<T: ?Sized> Future for RwLockWriteOwnedGuardFuture<T> type Output = RwLockWriteOwnedGuard<T>;
[src]
Notable traits for RwLockWriteOwnedGuardFuture<T>
impl<T: ?Sized> Future for RwLockWriteOwnedGuardFuture<T> type Output = RwLockWriteOwnedGuard<T>;
Acquires the mutex for are write.
Returns a guard that releases the mutex and wake the next locker when it will be dropped.
WriteLockOwnedGuard
have a 'static
lifetime, but requires the Arc<RWLock<T>>
type
Examples
use fast_async_mutex::rwlock::RwLock; use std::sync::Arc; #[tokio::main] async fn main() { let mutex = Arc::new(RwLock::new(10)); let mut guard = mutex.write_owned().await; *guard += 1; assert_eq!(*guard, 11); }
pub fn read(&self) -> RwLockReadGuardFuture<'_, T>ⓘNotable traits for RwLockReadGuardFuture<'a, T>
impl<'a, T: ?Sized> Future for RwLockReadGuardFuture<'a, T> type Output = RwLockReadGuard<'a, T>;
[src]
Notable traits for RwLockReadGuardFuture<'a, T>
impl<'a, T: ?Sized> Future for RwLockReadGuardFuture<'a, T> type Output = RwLockReadGuard<'a, T>;
Acquires the mutex for are read.
Returns a guard that releases the mutex and wake the next locker when it will be dropped.
Examples
use fast_async_mutex::rwlock::RwLock; #[tokio::main] async fn main() { let mutex = RwLock::new(10); let guard = mutex.read().await; let guard2 = mutex.read().await; assert_eq!(*guard, *guard2); }
pub fn read_owned(self: &Arc<Self>) -> RwLockReadOwnedGuardFuture<T>ⓘNotable traits for RwLockReadOwnedGuardFuture<T>
impl<T: ?Sized> Future for RwLockReadOwnedGuardFuture<T> type Output = RwLockReadOwnedGuard<T>;
[src]
Notable traits for RwLockReadOwnedGuardFuture<T>
impl<T: ?Sized> Future for RwLockReadOwnedGuardFuture<T> type Output = RwLockReadOwnedGuard<T>;
Acquires the mutex for are write.
Returns a guard that releases the mutex and wake the next locker when it will be dropped.
WriteLockOwnedGuard
have a 'static
lifetime, but requires the Arc<RWLock<T>>
type
Examples
use fast_async_mutex::rwlock::RwLock; use std::sync::Arc; #[tokio::main] async fn main() { let mutex = Arc::new(RwLock::new(10)); let guard = mutex.read().await; let guard2 = mutex.read().await; assert_eq!(*guard, *guard2); }
Trait Implementations
impl<T: Debug + ?Sized> Debug for RwLock<T>
[src]
impl<T: ?Sized> Send for RwLock<T> where
T: Send,
[src]
T: Send,
impl<T: ?Sized> Sync for RwLock<T> where
T: Send + Sync,
[src]
T: Send + Sync,
Auto Trait Implementations
impl<T> !RefUnwindSafe for RwLock<T>
impl<T: ?Sized> Unpin for RwLock<T> where
T: Unpin,
T: Unpin,
impl<T: ?Sized> UnwindSafe for RwLock<T> where
T: UnwindSafe,
T: UnwindSafe,
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,
pub fn borrow_mut(&mut self) -> &mut 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, 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.
pub 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>,