From b22b0dd7ff56d433c459e0d14e14eb5472a6224d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Mar 2021 01:16:26 +0100 Subject: Update `window_clipboard` to `0.2` --- native/src/clipboard.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'native/src/clipboard.rs') diff --git a/native/src/clipboard.rs b/native/src/clipboard.rs index ecdccabf..3eeb184d 100644 --- a/native/src/clipboard.rs +++ b/native/src/clipboard.rs @@ -1,6 +1,6 @@ /// A buffer for short-term storage and transfer within and between /// applications. pub trait Clipboard { - /// Returns the current content of the [`Clipboard`] as text. - fn content(&self) -> Option; + /// Reads the current content of the [`Clipboard`] as text. + fn read(&self) -> Option; } -- cgit From 35425001edcb54d861a42ec6d23f9e57b37745fd Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Mar 2021 01:18:22 +0100 Subject: Introduce `write` method to `Clipboard` trait --- native/src/clipboard.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'native/src/clipboard.rs') diff --git a/native/src/clipboard.rs b/native/src/clipboard.rs index 3eeb184d..fdb769da 100644 --- a/native/src/clipboard.rs +++ b/native/src/clipboard.rs @@ -3,4 +3,7 @@ pub trait Clipboard { /// Reads the current content of the [`Clipboard`] as text. fn read(&self) -> Option; + + /// Writes the given text contents to the [`Clipboard`]. + fn write(&mut self, contents: String); } -- cgit From 21971e0037c2ddcb96fd48ea96332445de4137bb Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Mar 2021 01:59:02 +0100 Subject: Make `Clipboard` argument in `Widget` trait mutable --- native/src/clipboard.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'native/src/clipboard.rs') 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 { + None + } + + fn write(&mut self, _contents: String) {} +} -- cgit