Struct pairlock::UpdateGuard [−][src]
pub struct UpdateGuard<'a, T: 'a> { /* fields omitted */ }
A RAII guard providing mutable access to the inactive value of a PairLock
,
The values becomes active when the guard is dropped.
Methods
impl<'a, T> UpdateGuard<'a, T>
[src]
impl<'a, T> UpdateGuard<'a, T>
pub fn active(this: &Self) -> &T
[src]
pub fn active(this: &Self) -> &T
Returns a shared reference to the active value of the PairLock
.
It can not be mutate it while the PairLock
is locked, and is therefore
safe to read.
pub fn both(this: &mut Self) -> (&mut T, &T)
[src]
pub fn both(this: &mut Self) -> (&mut T, &T)
Returns references to both the inactive (mutable) and active value of
the PairLock
.
pub fn cancel(this: Self)
[src]
pub fn cancel(this: Self)
Aborts the update by releasing the lock without making the mutable value active.
Any changes made to the inactive value will however be visible to the
next .update()
or .replace()
.
Trait Implementations
impl<'a, T> Drop for UpdateGuard<'a, T>
[src]
impl<'a, T> Drop for UpdateGuard<'a, T>
impl<'a, T> Deref for UpdateGuard<'a, T>
[src]
impl<'a, T> Deref for UpdateGuard<'a, T>
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
fn deref(&self) -> &T
Dereferences the value.
impl<'a, T> DerefMut for UpdateGuard<'a, T>
[src]
impl<'a, T> DerefMut for UpdateGuard<'a, T>
impl<'a, T: Debug> Debug for UpdateGuard<'a, T>
[src]
impl<'a, T: Debug> Debug for UpdateGuard<'a, T>
fn fmt(&self, fmtr: &mut Formatter) -> Result
[src]
fn fmt(&self, fmtr: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a, T> PartialEq for UpdateGuard<'a, T>
[src]
impl<'a, T> PartialEq for UpdateGuard<'a, T>
Auto Trait Implementations
impl<'a, T> !Send for UpdateGuard<'a, T>
impl<'a, T> !Send for UpdateGuard<'a, T>
impl<'a, T> Sync for UpdateGuard<'a, T> where
T: Send + Sync,
impl<'a, T> Sync for UpdateGuard<'a, T> where
T: Send + Sync,