Remove copypasta and maintain our own fork
This commit is contained in:
parent
b55ba14585
commit
23004b960f
16 changed files with 685 additions and 40 deletions
10
windows/Cargo.toml
Normal file
10
windows/Cargo.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "window_clipboard_windows"
|
||||
version = "0.1.0"
|
||||
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clipboard-win = "2.1"
|
||||
33
windows/src/lib.rs
Normal file
33
windows/src/lib.rs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2016 Avraham Weinstock
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use clipboard_win::{get_clipboard_string, set_clipboard_string};
|
||||
|
||||
use std::error::Error;
|
||||
|
||||
pub struct Clipboard;
|
||||
|
||||
impl Clipboard {
|
||||
pub fn new() -> Result<Self, Box<dyn Error>> {
|
||||
Ok(Clipboard)
|
||||
}
|
||||
|
||||
pub fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
Ok(get_clipboard_string()?)
|
||||
}
|
||||
|
||||
pub fn write(&mut self, data: String) -> Result<(), Box<dyn Error>> {
|
||||
Ok(set_clipboard_string(&data)?)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue