pub struct ThemeSubscription { /* private fields */ }Expand description
RAII guard that keeps a theme watcher alive.
Holds a background thread and a shutdown channel. When dropped, the channel sender is dropped (signaling shutdown via disconnection) and the background thread is joined.
Note: ThemeSubscription is Send but not Sync. The background thread
handle and shutdown channel are not safe to share across threads, but the
guard can be moved to a different thread if needed.
§Important
You must bind this to a variable. If you discard it, the watcher stops immediately:
ⓘ
// WRONG -- watcher is dropped immediately:
on_theme_change(|e| println!("{e:?}"));
// RIGHT -- watcher lives as long as `_watcher`:
let _watcher = on_theme_change(|e| println!("{e:?}")).unwrap();Trait Implementations§
Source§impl Debug for ThemeSubscription
impl Debug for ThemeSubscription
Source§impl Drop for ThemeSubscription
impl Drop for ThemeSubscription
Auto Trait Implementations§
impl !RefUnwindSafe for ThemeSubscription
impl !Sync for ThemeSubscription
impl !UnwindSafe for ThemeSubscription
impl Freeze for ThemeSubscription
impl Send for ThemeSubscription
impl Unpin for ThemeSubscription
impl UnsafeUnpin for ThemeSubscription
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