()
| 12 | |
| 13 | impl Clipboard { |
| 14 | pub fn read() -> anyhow::Result<ClipboardContent> { |
| 15 | if let Ok(image_data) = read_image_from_clipboard() { |
| 16 | return Ok(ClipboardContent { |
| 17 | data: image_data, |
| 18 | mime: "image/png".to_string(), |
| 19 | }); |
| 20 | } |
| 21 | |
| 22 | let text = Self::read_text()?; |
| 23 | Ok(ClipboardContent { |
| 24 | data: text, |
| 25 | mime: "text/plain".to_string(), |
| 26 | }) |
| 27 | } |
| 28 | |
| 29 | pub fn read_text() -> anyhow::Result<String> { |
| 30 | if cfg!(target_os = "macos") { |
no test coverage detected