Remove clipboard_dummy crate

This commit is contained in:
Héctor Ramón Jiménez 2022-01-27 16:41:00 +07:00
parent 0f74d59198
commit 9a5cac87bf
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
5 changed files with 13 additions and 51 deletions

View file

@ -13,6 +13,7 @@ categories = ["gui"]
[dependencies]
raw-window-handle = "0.3"
thiserror = "1.0"
[target.'cfg(windows)'.dependencies]
clipboard-win = { version = "4.0", features = ["std"] }
@ -24,9 +25,6 @@ clipboard_macos = { version = "0.1", path = "./macos" }
clipboard_x11 = { version = "0.3", path = "./x11" }
clipboard_wayland = { version = "0.2", path = "./wayland" }
[target.'cfg(not(any(all(unix, not(any(target_os = "macos", target_os = "ios", target_os = "android", target_os = "emscripten"))), target_os = "windows", target_os = "macos", target_os = "ios", target_os = "android")))'.dependencies]
clipboard_dummy = { version = "0.3", path = "./dummy" }
[dev-dependencies]
rand = "0.8"
winit = "0.23"

View file

@ -1,12 +0,0 @@
[package]
name = "clipboard_dummy"
version = "0.3.1"
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
edition = "2018"
description = "A library to obtain access to the dummy clipboard"
license = "MIT"
repository = "https://github.com/hecrj/window_clipboard"
documentation = "https://docs.rs/clipboard_x11"
keywords = ["clipboard", "dummy"]
[dependencies]

View file

@ -1,7 +0,0 @@
Copyright (c) 2019 quininer@live.com, Héctor Ramón, window_clipboard_x11 contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,22 +0,0 @@
#[forbid(unsafe_code)]
use std::error::Error;
/// A connection to an Dummy [`Clipboard`].
pub struct Clipboard;
impl Clipboard {
/// Connect to the Dummy and obtain a [`Clipboard`].
pub fn connect() -> Result<Self, Box<dyn Error>> {
Ok(Clipboard)
}
/// Read the current [`Clipboard`] value.
pub fn read(&self) -> Result<String, Box<dyn Error>> {
Ok(String::new())
}
/// Write a new value to the [`Clipboard`].
pub fn write(&mut self, contents: String) -> Result<(), Box<dyn Error>> {
Ok(())
}
}

View file

@ -3,21 +3,26 @@ use crate::ClipboardProvider;
use raw_window_handle::HasRawWindowHandle;
use std::error::Error;
pub use clipboard_dummy as dummy;
struct Dummy;
pub fn connect<W: HasRawWindowHandle>(
window: &W,
_window: &W,
) -> Result<Box<dyn ClipboardProvider>, Box<dyn Error>> {
let clipboard = Box::new(dummy::Clipboard::connect()?);
Ok(clipboard)
Ok(Dummy)
}
impl ClipboardProvider for dummy::Clipboard {
impl ClipboardProvider for Dummy {
fn read(&self) -> Result<String, Box<dyn Error>> {
self.read()
Err(Error::Unimplemented)
}
fn write(&mut self, contents: String) -> Result<(), Box<dyn Error>> {
self.write(contents)
Err(Error::Unimplemented)
}
}
#[derive(Debug, Clone, Copy, thiserror::Error)]
enum Error {
#[error("unimplemented")]
Unimplemented,
}