Add dummy platform 🌮
This commit is contained in:
parent
fc11e948eb
commit
0f74d59198
7 changed files with 106 additions and 16 deletions
23
src/platform/dummy.rs
Normal file
23
src/platform/dummy.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
use crate::ClipboardProvider;
|
||||
|
||||
use raw_window_handle::HasRawWindowHandle;
|
||||
use std::error::Error;
|
||||
|
||||
pub use clipboard_dummy as dummy;
|
||||
|
||||
pub fn connect<W: HasRawWindowHandle>(
|
||||
window: &W,
|
||||
) -> Result<Box<dyn ClipboardProvider>, Box<dyn Error>> {
|
||||
let clipboard = Box::new(dummy::Clipboard::connect()?);
|
||||
Ok(clipboard)
|
||||
}
|
||||
|
||||
impl ClipboardProvider for dummy::Clipboard {
|
||||
fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
self.read()
|
||||
}
|
||||
|
||||
fn write(&mut self, contents: String) -> Result<(), Box<dyn Error>> {
|
||||
self.write(contents)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue