clipboard-win

Rust win clipboard utilities

Latest version: 5.4.0 registry icon
Maintenance score
18
Safety score
100
Popularity score
72
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
5.4.0 0 0 0 0 0
5.3.1 0 0 0 0 0
5.3.0 0 0 0 0 0
5.2.0 0 0 0 0 0
5.1.0 0 0 0 0 0
5.0.0 0 0 0 0 0
4.5.0 0 0 0 0 0
4.4.2 0 0 0 0 0
4.4.1 0 0 0 0 0
4.4.0 0 0 0 0 0
4.3.0 0 0 0 0 0
4.2.2 0 0 0 0 0
4.2.1 0 0 0 0 0
4.2.0 0 0 0 0 0
4.1.0 0 0 0 0 0
4.0.3 0 0 0 0 0
4.0.2 0 0 0 0 0
4.0.1 0 0 0 0 0
4.0.0 0 0 0 0 0
3.1.1 0 0 0 0 0
3.1.0 0 0 0 0 0
3.0.2 0 0 0 0 0
3.0.1 0 0 0 0 0
3.0.0 0 0 0 0 0
2.2.0 0 0 0 0 0
2.1.2 0 0 0 0 0
2.1.1 0 0 0 0 0
2.1.0 0 0 0 0 0
2.0.1 0 0 0 0 0
2.0.0 0 0 0 0 0
1.8.1 0 0 0 0 0
1.8.0 0 0 0 0 0
1.7.1 0 0 0 0 0
1.7.0 0 0 0 0 0
1.6.2 0 0 0 0 0
1.6.1 0 0 0 0 0
1.6.0 0 0 0 0 0
1.5.2 0 0 0 0 0
1.5.1 0 0 0 0 0
1.5.0 0 0 0 0 0
1.4.2 0 0 0 0 0
1.4.1 0 0 0 0 0
1.4.0 0 0 0 0 0
1.3.0 0 0 0 0 0
1.2.0 0 0 0 0 0
1.1.0 0 0 0 0 0
1.0.1 0 0 0 0 0
1.0.0 0 0 0 0 0
0.9.3 0 0 0 0 0
0.9.2 0 0 0 0 0
0.9.1 0 0 0 0 0
0.9.0 0 0 0 0 0
0.8.0 0 0 0 0 0
0.7.0 0 0 0 0 0
0.6.0 0 0 0 0 0
0.5.2 0 0 0 0 0
0.5.1 0 0 0 0 0
0.5.0 0 0 0 0 0
0.4.0 0 0 0 0 0
0.3.3 0 0 0 0 0
0.3.2 0 0 0 0 0
0.3.1 0 0 0 0 0
0.2.0 0 0 0 0 0

Stability
Latest release:

5.4.0 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

BSL-1.0   -   Boost Software License 1.0

Not a wildcard

Not proprietary

OSI Compliant



clipboard-win

Build Crates.io Docs.rs

This crate provide simple means to operate with Windows clipboard.

Note keeping Clipboard around:

In Windows Clipboard opens globally and only one application can set data onto format at the time.

Therefore as soon as operations are finished, user is advised to close Clipboard.

Clipboard

All read and write access to Windows clipboard requires user to open it.

Usage

Manually lock clipboard

use clipboard_win::{Clipboard, formats, Getter, Setter};

const SAMPLE: &str = "MY loli sample ^^";

let _clip = Clipboard::new_attempts(10).expect("Open clipboard");
formats::Unicode.write_clipboard(&SAMPLE).expect("Write sample");

let mut output = String::new();

assert_eq!(formats::Unicode.read_clipboard(&mut output).expect("Read sample"), SAMPLE.len());
assert_eq!(output, SAMPLE);

//Efficiently re-use buffer ;)
output.clear();
assert_eq!(formats::Unicode.read_clipboard(&mut output).expect("Read sample"), SAMPLE.len());
assert_eq!(output, SAMPLE);

//Or take the same string twice?
assert_eq!(formats::Unicode.read_clipboard(&mut output).expect("Read sample"), SAMPLE.len());
assert_eq!(format!("{0}{0}", SAMPLE), output);

Simplified API

use clipboard_win::{formats, get_clipboard, set_clipboard};

let text = "my sample ><";

set_clipboard(formats::Unicode, text).expect("To set clipboard");
//Type is necessary as string can be stored in various storages
let result: String = get_clipboard(formats::Unicode).expect("To set clipboard");
assert_eq!(result, text)