[][src]Function cli_clipboard::set_contents

pub fn set_contents(data: String) -> Result<()>

Write a string to the clipboard

This uses the platform default behavior for setting clipboard contents. Other users of the Wayland or X11 clipboard will only see the contents copied to the clipboard so long as the process copying to the clipboard exists. If you need the contents of the clipboard to remain after your application shuts down, consider using the set_contents_for_duration function. MacOS and Windows clipboard contents will stick around after your application exits.

Example

cli_clipboard::set_contents("testing".to_owned()).unwrap();
assert_eq!(cli_clipboard::get_contents().unwrap(), "testing");