arboard/examples/set_get_html.rs
Gae24 4b91bfe93e
Implement Get::html() for all platforms (#163)
* implement get html operation

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2025-02-12 22:01:02 -07:00

21 lines
555 B
Rust

use arboard::Clipboard;
use std::{thread, time::Duration};
fn main() {
env_logger::init();
let mut ctx = Clipboard::new().unwrap();
let html = r#"<h1>Hello, World!</h1>
<b>Lorem ipsum</b> dolor sit amet,<br>
<i>consectetur adipiscing elit</i>."#;
let alt_text = r#"Hello, World!
Lorem ipsum dolor sit amet,
consectetur adipiscing elit."#;
ctx.set_html(html, Some(alt_text)).unwrap();
thread::sleep(Duration::from_secs(5));
let success = ctx.get().html().unwrap() == html;
println!("Set and Get html operations were successful: {success}");
}