pub struct ReadbackIndices { /* private fields */ }Expand description
A helper class used to manage the current slots for writing data from the render thread and reading it from the UI thread. Used mostly by hit-testing which needs to know the last transform of the visual
The lock is held for the whole duration of a write: begin_write
returns a scope that owns the lock, and ReadbackWriteScope::end_write
(or dropping the scope) completes the write and releases it. The
revisions themselves are atomics and can be read from any thread without
taking the lock, as the properties of the C# class can.
Unlike the C# monitor the lock is not reentrant: calling
next_read, begin_write or
lock on the thread that currently holds a write scope or
a lock guard deadlocks.
Implementations§
Source§impl ReadbackIndices
impl ReadbackIndices
pub fn new() -> Self
Sourcepub fn lock(&self) -> MutexGuard<'_, ()>
pub fn lock(&self) -> MutexGuard<'_, ()>
Takes the lock that guards the indices (the public _lock field of
the C# class), blocking writes and next_read
while the guard is alive.
pub fn read_revision(&self) -> u64
pub fn write_revision(&self) -> u64
pub fn last_completed_write(&self) -> u64
pub fn next_read(&self)
Sourcepub fn begin_write(&self) -> ReadbackWriteScope<'_>
pub fn begin_write(&self) -> ReadbackWriteScope<'_>
Takes the lock and starts the next write revision. The write lasts until the returned scope is ended.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ReadbackIndices
impl RefUnwindSafe for ReadbackIndices
impl Send for ReadbackIndices
impl Sync for ReadbackIndices
impl Unpin for ReadbackIndices
impl UnsafeUnpin for ReadbackIndices
impl UnwindSafe for ReadbackIndices
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more