1pub mod common;
2mod platform;
3pub use common::{ClipboardContent, ClipboardHandler, ContentFormat, Result, RustImageData};
4pub use image::imageops::FilterType;
5#[cfg(target_os = "linux")]
6pub use platform::ClipboardContextX11Options;
7pub use platform::{ClipboardContext, ClipboardWatcherContext, WatcherShutdown};
8
9pub trait Clipboard: Send {
10 fn available_formats(&self) -> Result<Vec<String>>;
13
14 fn has(&self, format: ContentFormat) -> bool;
15
16 fn clear(&self) -> Result<()>;
19
20 fn get_buffer(&self, format: &str) -> Result<Vec<u8>>;
23
24 fn get_text(&self) -> Result<String>;
27
28 fn get_rich_text(&self) -> Result<String>;
31
32 fn get_html(&self) -> Result<String>;
35
36 fn get_image(&self) -> Result<RustImageData>;
37
38 fn get_files(&self) -> Result<Vec<String>>;
39
40 fn get(&self, formats: &[ContentFormat]) -> Result<Vec<ClipboardContent>>;
41
42 fn set_buffer(&self, format: &str, buffer: Vec<u8>) -> Result<()>;
43
44 fn set_text(&self, text: String) -> Result<()>;
45
46 fn set_rich_text(&self, text: String) -> Result<()>;
47
48 fn set_html(&self, html: String) -> Result<()>;
49
50 fn set_image(&self, image: RustImageData) -> Result<()>;
51
52 fn set_files(&self, files: Vec<String>) -> Result<()>;
53
54 fn set(&self, contents: Vec<ClipboardContent>) -> Result<()>;
56}
57
58pub trait ClipboardWatcher<T: ClipboardHandler>: Send {
59 fn add_handler(&mut self, handler: T) -> &mut Self;
62
63 fn start_watch(&mut self);
66
67 fn get_shutdown_channel(&self) -> WatcherShutdown;
70}
71
72impl WatcherShutdown {
73 pub fn stop(self) {
76 drop(self);
77 }
78}