pub struct TBBackGuard<'a, T> { /* private fields */ }Expand description
An RAII guard holding a lock on the back buffer.
The back buffer can be accessed via the back and
back_mut methods and committed with the swap
method. After swapping, the back buffer will be in an indeterminate state and may be either the
previous front buffer or previous pending buffer. Usually callers should ensure the back buffer
is fully cleared or rewritten after acquiring the lock and before calling
swap. Dropping the guard structure without calling
swap will unlock the back buffer, leaving it in the same state for the
next time it’s locked.
The pending and pending_mut methods can
also be used to access the pending buffer if it was not locked at the time this structure was
created. The primary reason to access the pending is to free data in the pending buffer without
having to wait for the next swap.
Implementations§
Source§impl<T> TBBackGuard<'_, T>
impl<T> TBBackGuard<'_, T>
Sourcepub fn pending(&self) -> Option<&T>
pub fn pending(&self) -> Option<&T>
Returns a reference to the pending buffer, or None if the pending buffer was locked at
the time the structure was created.
Sourcepub fn pending_mut(&mut self) -> Option<&mut T>
pub fn pending_mut(&mut self) -> Option<&mut T>
Returns a mutable reference to the pending buffer, or None if the pending buffer was
locked at the time the structure was created.