[][src]Trait cli_clipboard::ClipboardProvider

pub trait ClipboardProvider: Sized {
    fn new() -> Result<Self>;
fn get_contents(&mut self) -> Result<String>;
fn set_contents(&mut self, content: String) -> Result<()>;
fn clear(&mut self) -> Result<()>; }

Trait for clipboard access

Required methods

fn new() -> Result<Self>

Create a context with which to access the clipboard

fn get_contents(&mut self) -> Result<String>

Method to get the clipboard contents as a String

fn set_contents(&mut self, content: String) -> Result<()>

Method to set the clipboard contents as a String

fn clear(&mut self) -> Result<()>

Method to clear the clipboard

Loading content...

Implementors

impl ClipboardProvider for LinuxClipboardContext[src]

impl ClipboardProvider for WaylandClipboardContext[src]

fn new() -> Result<WaylandClipboardContext>[src]

Constructs a new WaylandClipboardContext that operates on all seats using the data-control clipboard protocol. This is intended for CLI applications that do not create Wayland windows.

Attempts to detect whether the primary selection is supported. Assumes no primary selection support if no seats are available. In addition to returning Err on communication errors (such as when operating in an X11 environment), will also return Err if the compositor does not support the data-control protocol.

fn get_contents(&mut self) -> Result<String>[src]

Pastes from the Wayland clipboard.

If the Wayland environment supported the primary selection when this context was constructed, first checks the primary selection. If pasting from the primary selection raises an error or the primary selection is unsupported, falls back to the regular clipboard.

An empty clipboard is not considered an error, but the clipboard must indicate a text MIME type and the contained text must be valid UTF-8.

fn set_contents(&mut self, data: String) -> Result<()>[src]

Copies to the Wayland clipboard.

If the Wayland environment supported the primary selection when this context was constructed, this will copy to both the primary selection and the regular clipboard. Otherwise, only the regular clipboard will be pasted to.

impl<S> ClipboardProvider for X11ClipboardContext<S> where
    S: Selection
[src]

Loading content...