clipboard 0.5.0

rust-clipboard is a cross-platform library for getting and setting the contents of the OS-level clipboard.
1
2
3
4
5
6
7
8
9
10
11
12
extern crate clipboard;

use clipboard::ClipboardProvider;
use clipboard::ClipboardContext;

fn main() {
    let mut ctx: ClipboardContext = ClipboardProvider::new().unwrap();

    let the_string = "Hello, world!";

    ctx.set_contents(the_string.to_owned()).unwrap();
}