Skip to main content

Trait tauri::ClipboardManager

pub trait ClipboardManager: Debug {
    fn write_text<T>(&mut self, text: T) -> Result<(), Error>
    where
        T: Into<String>;

    fn read_text(&self) -> Result<Option<String>, Error>;
}

Expand description

Clipboard manager.

Required methods#

fn write_text<T>(&mut self, text: T) -> Result<(), Error> where T: Into<String>,#

Writes the text into the clipboard as plain text.

Panics#

  • Panics if the event loop is not running yet, usually when called on the tauri::Builder#setup closure.
  • Panics when called on the main thread, usually on the tauri::App#runclosure.

You can spawn a task to use the API using tauri::async_runtime::spawn or std::thread::spawn to prevent the panic.

fn read_text(&self) -> Result<Option<String>, Error>#

Read the content in the clipboard as plain text.

Panics#

  • Panics if the event loop is not running yet, usually when called on the tauri::Builder#setup closure.
  • Panics when called on the main thread, usually on the tauri::App#runclosure.

You can spawn a task to use the API using tauri::async_runtime::spawn or std::thread::spawn to prevent the panic.

Implementations on Foreign Types#

impl ClipboardManager for ClipboardManagerWrapper#

pub fn read_text(&self) -> Result<Option<String>, Error>#

pub fn write_text<T>(&mut self, text: T) -> Result<(), Error> where T: Into<String>,#

Implementors#