pub struct Clipboard { /* private fields */ }
Expand description

The OS independent struct for accessing the clipboard.

Any number of Clipboard instances are allowed to exist at a single point in time. Note however that all Clipboards must be ‘dropped’ before the program exits. In most scenarios this happens automatically but there are frameworks (for example winit) that take over the execution and where the objects don’t get dropped when the application exits. In these cases you have to make sure the object is dropped by taking ownership of it in a confined scope when detecting that your application is about to quit.

It is also valid to have multiple Clipboards on separate threads at once but note that executing multiple clipboard operations in parallel might fail with a ClipboardOccupied error.

Implementations

Creates an instance of the clipboard

Fetches utf-8 text from the clipboard and returns it.

Places the text onto the clipboard. Any valid utf-8 string is accepted.

Fetches image data from the clipboard, and returns the decoded pixels.

Any image data placed on the clipboard with set_image will be possible read back, using this function. However it’s of not guaranteed that an image placed on the clipboard by any other application will be of a supported format.

Places an image to the clipboard.

The chosen output format, depending on the platform is the following:

  • On macOS: NSImage object
  • On Linux: PNG, under the atom image/png
  • On Windows: In order of priority CF_DIB and CF_BITMAP

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.