Make Clipboard argument in Widget trait mutable
This commit is contained in:
parent
35425001ed
commit
21971e0037
31 changed files with 173 additions and 127 deletions
|
|
@ -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) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue