t_rust_less_lib/clipboard/
mod.rs1mod error;
2#[cfg(all(unix, feature = "with_x11", feature = "with_wayland"))]
3mod unix_mixed;
4#[cfg(all(unix, not(any(feature = "with_x11", feature = "with_wayland"))))]
5mod unix_none;
6#[cfg(all(unix, feature = "with_wayland"))]
7pub mod unix_wayland;
8#[cfg(all(unix, feature = "with_x11"))]
9mod unix_x11;
10#[cfg(windows)]
11mod windows;
12
13use zeroize::Zeroizing;
14
15#[cfg(not(windows))]
16mod selection_provider_holder;
17
18use std::sync::Arc;
19
20use crate::api::{ClipboardProviding, EventHub};
21
22pub use self::error::*;
23#[cfg(all(unix, feature = "with_x11", feature = "with_wayland"))]
24pub use self::unix_mixed::Clipboard;
25#[cfg(all(unix, not(any(feature = "with_x11", feature = "with_wayland"))))]
26pub use self::unix_none::Clipboard;
27#[cfg(all(unix, feature = "with_wayland", not(feature = "with_x11")))]
28pub use self::unix_wayland::Clipboard;
29#[cfg(all(unix, feature = "with_x11", not(feature = "with_wayland")))]
30pub use self::unix_x11::Clipboard;
31#[cfg(windows)]
32pub use self::windows::Clipboard;
33
34pub trait SelectionProvider: Send + Sync {
35 fn current_selection(&self) -> Option<ClipboardProviding>;
36
37 fn get_selection_value(&self) -> Option<Zeroizing<String>>;
38
39 fn next_selection(&mut self);
40}
41
42pub trait ClipboardCommon: Sized {
43 fn new<T>(selection_provider: T, event_hub: Arc<dyn EventHub>) -> ClipboardResult<Self>
44 where
45 T: SelectionProvider + Clone + 'static;
46
47 fn destroy(&self);
48
49 fn is_open(&self) -> bool;
50
51 fn currently_providing(&self) -> Option<ClipboardProviding>;
52
53 fn provide_next(&self);
54
55 fn wait(&self) -> ClipboardResult<()>;
56}