Struct clipboard_rs::WatcherShutdown
source · pub struct WatcherShutdown { /* private fields */ }Implementations§
source§impl WatcherShutdown
impl WatcherShutdown
sourcepub fn stop(self)
pub fn stop(self)
Signals shutdown
Examples found in repository?
examples/watch_change.rs (line 18)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
fn main() {
let ctx = ClipboardContext::new().unwrap();
let mut watcher = ClipboardWatcherContext::new().unwrap();
watcher.add_handler(Box::new(move || {
let content = ctx.get_text().unwrap();
println!("read:{}", content);
}));
let watcher_shutdown = watcher.get_shutdown_channel();
thread::spawn(move || {
thread::sleep(Duration::from_secs(5));
println!("stop watch!");
watcher_shutdown.stop();
});
println!("start watch!");
watcher.start_watch();
}Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for WatcherShutdown
impl Send for WatcherShutdown
impl Sync for WatcherShutdown
impl Unpin for WatcherShutdown
impl UnwindSafe for WatcherShutdown
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