Skip to main content

Clipboard

Trait Clipboard 

Source
pub trait Clipboard {
    // Required methods
    fn put(&mut self, slot: &Slot, item: ClipItem, origin: &Origin) -> Answer;
    fn get(&self, slot: &Slot) -> Option<ClipItem>;
    fn rev(&self) -> u64;

    // Provided methods
    fn offers(&self, slot: &Slot) -> Vec<FormatId> { ... }
    fn may_use(&self, origin: &Origin, slot: &Slot) -> Result<(), String> { ... }
    fn take_events(&mut self) -> Vec<(String, Json)> { ... }
    fn system(&mut self) -> Option<&mut dyn SystemBackend> { ... }
}
Expand description

The owner of the clipboard, as the interface reaches it.

Required Methods§

Source

fn put(&mut self, slot: &Slot, item: ClipItem, origin: &Origin) -> Answer

Keeps an item in a slot, replacing what it held.

Source

fn get(&self, slot: &Slot) -> Option<ClipItem>

The item a slot holds.

Source

fn rev(&self) -> u64

The revision: one more at each put.

Provided Methods§

Source

fn offers(&self, slot: &Slot) -> Vec<FormatId>

The formats a slot offers.

Source

fn may_use(&self, origin: &Origin, slot: &Slot) -> Result<(), String>

Whether origin may read and write slot: by default, the user any slot, a session its own only (default_access).

Source

fn take_events(&mut self) -> Vec<(String, Json)>

The events to publish since the last call, as (name, data).

Source

fn system(&mut self) -> Option<&mut dyn SystemBackend>

The owner’s own way to the system clipboard (a kernel writing its private types there): it wins over the one installed with set_backend, which wins over egui’s text.

Implementors§