diff options
author | 2024-02-07 17:25:40 +0100 | |
---|---|---|
committer | 2024-02-13 03:14:30 +0100 | |
commit | 4155edab8d123b767ddad67e24ca2d4c50f31ece (patch) | |
tree | 30c81bc419920dd2e425f05caf160377b85ca961 /core/src/clipboard.rs | |
parent | 7615b2240c360fea21ef041bfd5b1deb73fc03d1 (diff) | |
download | iced-4155edab8d123b767ddad67e24ca2d4c50f31ece.tar.gz iced-4155edab8d123b767ddad67e24ca2d4c50f31ece.tar.bz2 iced-4155edab8d123b767ddad67e24ca2d4c50f31ece.zip |
Add support for primary clipboard
Diffstat (limited to 'core/src/clipboard.rs')
-rw-r--r-- | core/src/clipboard.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/src/clipboard.rs b/core/src/clipboard.rs index 081b4004..ff2e31d0 100644 --- a/core/src/clipboard.rs +++ b/core/src/clipboard.rs @@ -8,6 +8,12 @@ pub trait Clipboard { /// Writes the given text contents to the [`Clipboard`]. fn write(&mut self, contents: String); + + /// Reads the current content of Primary as text. + fn read_primary(&self) -> Option<String>; + + /// Writes the given text contents to Primary. + fn write_primary(&mut self, contents: String); } /// A null implementation of the [`Clipboard`] trait. @@ -20,4 +26,10 @@ impl Clipboard for Null { } fn write(&mut self, _contents: String) {} + + fn read_primary(&self) -> Option<String> { + None + } + + fn write_primary(&mut self, _contents: String) {} } |