init
This commit is contained in:
commit
956746d3e3
5 changed files with 104 additions and 0 deletions
21
src/main.rs
Normal file
21
src/main.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use clipboard_macos::*;
|
||||
use std::{thread, time};
|
||||
|
||||
fn main() {
|
||||
let c = Clipboard::new().unwrap();
|
||||
let mut cstr = String::new();
|
||||
let ten_millis = time::Duration::from_millis(10);
|
||||
|
||||
loop {
|
||||
let nstr = c.read();
|
||||
if nstr.is_err() {
|
||||
continue;
|
||||
}
|
||||
let nstr = nstr.unwrap();
|
||||
if nstr != cstr {
|
||||
println!("{}", nstr);
|
||||
cstr = nstr;
|
||||
}
|
||||
thread::sleep(ten_millis);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue