pub struct ReadGuard<'a, T, Codec = Default>(/* private fields */);Available on crate feature
robj only.Expand description
RAII structure used to release the shared read access of a lock when dropped.
As long as this is held, no write access to the lock can occur. It is therefore recommend to either hold the guard for only short periods of time or call invalidated to be notified when write access is requested.
Implementations§
Source§impl<T, Codec> ReadGuard<'_, T, Codec>where
Codec: Codec,
impl<T, Codec> ReadGuard<'_, T, Codec>where
Codec: Codec,
Sourcepub async fn invalidated(&self)
pub async fn invalidated(&self)
Waits until the shared value is invalidated because a write request is made.
In this case the holder should drop this guard and reissue the read request to obtain the new value. As long as the guard is held the shared value will not be changed.
This also returns when the owner is dropped or a connection error occurs.
Sourcepub fn is_invalidated(&self) -> bool
pub fn is_invalidated(&self) -> bool
Returns true, if the shared value has been invalidated.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, Codec> Freeze for ReadGuard<'a, T, Codec>
impl<'a, T, Codec> RefUnwindSafe for ReadGuard<'a, T, Codec>where
T: RefUnwindSafe,
Codec: RefUnwindSafe,
impl<'a, T, Codec> Send for ReadGuard<'a, T, Codec>
impl<'a, T, Codec> Sync for ReadGuard<'a, T, Codec>
impl<'a, T, Codec> Unpin for ReadGuard<'a, T, Codec>
impl<'a, T, Codec> UnsafeUnpin for ReadGuard<'a, T, Codec>
impl<'a, T, Codec> UnwindSafe for ReadGuard<'a, T, Codec>where
T: RefUnwindSafe,
Codec: RefUnwindSafe,
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