Make Clipboard argument in Widget trait mutable

This commit is contained in:
Héctor Ramón Jiménez 2021-03-10 01:59:02 +01:00
parent 35425001ed
commit 21971e0037
31 changed files with 173 additions and 127 deletions

View file

@ -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) {}
}