diff options
author | 2021-03-10 01:59:02 +0100 | |
---|---|---|
committer | 2021-03-10 01:59:02 +0100 | |
commit | 21971e0037c2ddcb96fd48ea96332445de4137bb (patch) | |
tree | 7cc1dc9147923a45c25f70d187cdecf08ab33497 /native/src/clipboard.rs | |
parent | 35425001edcb54d861a42ec6d23f9e57b37745fd (diff) | |
download | iced-21971e0037c2ddcb96fd48ea96332445de4137bb.tar.gz iced-21971e0037c2ddcb96fd48ea96332445de4137bb.tar.bz2 iced-21971e0037c2ddcb96fd48ea96332445de4137bb.zip |
Make `Clipboard` argument in `Widget` trait mutable
Diffstat (limited to 'native/src/clipboard.rs')
-rw-r--r-- | native/src/clipboard.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/native/src/clipboard.rs b/native/src/clipboard.rs index fdb769da..081b4004 100644 --- a/native/src/clipboard.rs +++ b/native/src/clipboard.rs @@ -1,3 +1,5 @@ +//! Access the clipboard. + /// A buffer for short-term storage and transfer within and between /// applications. pub trait Clipboard { @@ -7,3 +9,15 @@ pub trait Clipboard { /// Writes the given text contents to the [`Clipboard`]. fn write(&mut self, contents: String); } + +/// A null implementation of the [`Clipboard`] trait. +#[derive(Debug, Clone, Copy)] +pub struct Null; + +impl Clipboard for Null { + fn read(&self) -> Option<String> { + None + } + + fn write(&mut self, _contents: String) {} +} |