Skip to main content

EventTransfer

Trait EventTransfer 

pub trait EventTransfer {
    // Required methods
    fn set_text(&self, text: &str) -> bool;
    fn text(&self) -> Option<String>;

    // Provided methods
    fn set_rich_text(&self, html: &str, plain: &str) -> bool { ... }
    fn rich_text(&self) -> Option<RichTextOffer> { ... }
    fn image(&self) -> Option<ClipboardImage> { ... }
}
Expand description

The data of one trusted clipboard event (the browser’s DataTransfer).

Required Methods§

fn set_text(&self, text: &str) -> bool

Offer text as text/plain. Returns whether the event took it.

fn text(&self) -> Option<String>

The event’s text/plain, if any.

Provided Methods§

fn set_rich_text(&self, html: &str, plain: &str) -> bool

Offer html as text/html with plain as its text/plain fallback. Returns whether the event took both. The default offers only plain.

fn rich_text(&self) -> Option<RichTextOffer>

Paired HTML/plain payloads from this same event. Optional and bounded; returning None leaves the ordinary plain-text read available.

fn image(&self) -> Option<ClipboardImage>

The picture this same event pastes (a screenshot, an image copied in another app), as an encoded file of one of PASTED_IMAGE_TYPES. Optional.

Implementors§