diff options
Diffstat (limited to '')
-rw-r--r-- | core/src/clipboard.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/core/src/clipboard.rs b/core/src/clipboard.rs index 081b4004..5df3e267 100644 --- a/core/src/clipboard.rs +++ b/core/src/clipboard.rs @@ -4,10 +4,21 @@ /// applications. pub trait Clipboard { /// Reads the current content of the [`Clipboard`] as text. - fn read(&self) -> Option<String>; + fn read(&self, kind: Kind) -> Option<String>; /// Writes the given text contents to the [`Clipboard`]. - fn write(&mut self, contents: String); + fn write(&mut self, kind: Kind, contents: String); +} + +/// The kind of [`Clipboard`]. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Kind { + /// The standard clipboard. + Standard, + /// The primary clipboard. + /// + /// Normally only present in X11 and Wayland. + Primary, } /// A null implementation of the [`Clipboard`] trait. @@ -15,9 +26,9 @@ pub trait Clipboard { pub struct Null; impl Clipboard for Null { - fn read(&self) -> Option<String> { + fn read(&self, _kind: Kind) -> Option<String> { None } - fn write(&mut self, _contents: String) {} + fn write(&mut self, _kind: Kind, _contents: String) {} } |