pub struct StateObserver { /* private fields */ }Expand description
State observer for monitoring state changes
Implementations§
Source§impl StateObserver
impl StateObserver
Sourcepub fn new(thread_id: u32, shared_state: Arc<SharedDeviceState>) -> Self
pub fn new(thread_id: u32, shared_state: Arc<SharedDeviceState>) -> Self
Create a new state observer
Sourcepub fn wait_for_change(&self, timeout: Duration) -> Option<StateChangeType>
pub fn wait_for_change(&self, timeout: Duration) -> Option<StateChangeType>
Wait for a state change with timeout
Sourcepub fn check_for_change(&self) -> Option<StateChangeType>
pub fn check_for_change(&self) -> Option<StateChangeType>
Check for a state change without blocking
Sourcepub fn process_all_changes<F>(&self, handler: F)where
F: FnMut(StateChangeType),
pub fn process_all_changes<F>(&self, handler: F)where
F: FnMut(StateChangeType),
Process all pending state changes
Get the shared state
Auto Trait Implementations§
impl Freeze for StateObserver
impl !RefUnwindSafe for StateObserver
impl Send for StateObserver
impl Sync for StateObserver
impl Unpin for StateObserver
impl !UnwindSafe for StateObserver
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