Introduce write
method to Clipboard
trait
This commit is contained in:
parent
b22b0dd7ff
commit
35425001ed
@ -3,4 +3,7 @@
|
||||
pub trait Clipboard {
|
||||
/// Reads the current content of the [`Clipboard`] as text.
|
||||
fn read(&self) -> Option<String>;
|
||||
|
||||
/// Writes the given text contents to the [`Clipboard`].
|
||||
fn write(&mut self, contents: String);
|
||||
}
|
||||
|
@ -16,4 +16,11 @@ impl iced_native::Clipboard for Clipboard {
|
||||
fn read(&self) -> Option<String> {
|
||||
self.0.read().ok()
|
||||
}
|
||||
|
||||
fn write(&mut self, contents: String) {
|
||||
match self.0.write(contents) {
|
||||
Ok(()) => {}
|
||||
Err(error) => log::warn!("error writing to clipboard: {}", error),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user