diff --git a/winit/src/clipboard.rs b/winit/src/clipboard.rs index 15dc989f..ca25c065 100644 --- a/winit/src/clipboard.rs +++ b/winit/src/clipboard.rs @@ -20,17 +20,17 @@ impl Clipboard { Clipboard { state } } -} -impl iced_native::Clipboard for Clipboard { - fn read(&self) -> Option { + /// Reads the current content of the [`Clipboard`] as text. + pub fn read(&self) -> Option { match &self.state { State::Connected(clipboard) => clipboard.read().ok(), State::Unavailable => None, } } - fn write(&mut self, contents: String) { + /// Writes the given text contents to the [`Clipboard`]. + pub fn write(&mut self, contents: String) { match &mut self.state { State::Connected(clipboard) => match clipboard.write(contents) { Ok(()) => {} @@ -42,3 +42,13 @@ impl iced_native::Clipboard for Clipboard { } } } + +impl iced_native::Clipboard for Clipboard { + fn read(&self) -> Option { + self.read() + } + + fn write(&mut self, contents: String) { + self.write(contents) + } +}