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