Function terminal_clipboard::set_string
source · pub fn set_string<S: AsRef<str>>(s: S) -> Result<(), ClipboardError>
Expand description
Fill the clipboard with the given string
Examples found in repository?
examples/write_read.rs (line 12)
4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
println!("Clipboard backend type: {:?}", terminal_clipboard::get_type());
println!(
"Initial content of the clipboard: {:?}",
terminal_clipboard::get_string().unwrap(),
);
let s = "TEST";
println!("Writing {:?} in the clipboard", s);
terminal_clipboard::set_string(s).unwrap();
println!(
"New content of the clipboard: {:?}",
terminal_clipboard::get_string().unwrap(),
);
}