1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use clipboard_win::{empty, get_clipboard_string, set_clipboard_string, Clipboard};
use crate::common::ClipboardProvider;
use crate::Result;
pub struct WindowsClipboardContext;
impl ClipboardProvider for WindowsClipboardContext {
fn new() -> Result<Self> {
Ok(WindowsClipboardContext)
}
fn get_contents(&mut self) -> Result<String> {
Ok(get_clipboard_string()?)
}
fn set_contents(&mut self, data: String) -> Result<()> {
Ok(set_clipboard_string(&data)?)
}
fn clear(&mut self) -> Result<()> {
let _clip = Clipboard::new_attempts(10)?;
Ok(empty()?)
}
}