### Basic Clipboard Usage Source: https://github.com/alacritty/copypasta/blob/master/README.md Demonstrates how to initialize a clipboard context, set text content, and retrieve it using the copypasta library. Requires the copypasta crate. ```rust extern crate copypasta; use copypasta::{ClipboardContext, ClipboardProvider}; fn main() { let mut ctx = ClipboardContext::new().unwrap(); let msg = "Hello, world!"; ctx.set_contents(msg.to_owned()).unwrap(); let content = ctx.get_contents().unwrap(); println!("{}", content); } ``` -------------------------------- ### ClipboardProvider Trait API Source: https://github.com/alacritty/copypasta/blob/master/README.md Defines the core interface for clipboard interaction within the copypasta library. Implementations handle OS-specific clipboard access. ```APIDOC ClipboardProvider: get_contents(&mut self) -> Result> Retrieves the current text content from the clipboard. Returns: A Result containing the clipboard content as a String or an error. set_contents(&mut self, String) -> Result<(), Box> Sets the clipboard content to the provided String. Parameters: String: The text content to set on the clipboard. Returns: A Result indicating success or an error if the content could not be set. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.