pub struct ClipItem {
pub kind: FormatId,
pub version: u32,
pub payload: Value,
pub title: String,
pub title_key: Option<TitleKey>,
pub fallbacks: Vec<Repr>,
pub origin: ClipOrigin,
pub stripped: Vec<Stripped>,
pub external: bool,
}Expand description
What one copy made: a typed item with its readable fallbacks.
Fields§
§kind: FormatIdIts type: a private type, or a standard format for content that came from outside.
version: u32The version of its type it was made at.
payload: Value§title: StringWhat it is, for menus and toasts (“a colour”, “3 nodes”), in English.
title_key: Option<TitleKey>Its title as a catalogue message, shown in the interface’s
language (title is its English).
fallbacks: Vec<Repr>Its other representations, richest first (text last).
origin: ClipOrigin§stripped: Vec<Stripped>What sanitisers removed on the boundaries it crossed.
external: boolWhether it came from outside the owner (the system clipboard).
Implementations§
Source§impl ClipItem
impl ClipItem
pub fn new(kind: FormatId, version: u32, payload: Json, title: &str) -> Self
Sourcepub fn external_text(text: &str) -> Self
pub fn external_text(text: &str) -> Self
Text from outside the owner (another application’s).
Sourcepub fn title_key(self, key: &str, args: &[(&str, &str)]) -> Self
pub fn title_key(self, key: &str, args: &[(&str, &str)]) -> Self
Its title as a catalogue message with its arguments ({ $count }
nodes): the interface shows it in its language, the English
title where the catalogue has no translation. The arguments are
text, shown as they are written: a count is written by the caller.
Sourcepub fn external(reprs: Vec<Repr>) -> Option<Self>
pub fn external(reprs: Vec<Repr>) -> Option<Self>
Content from outside the owner in several representations,
richest first (what the system clipboard held: files, an image,
HTML, text); None when there is none. Its type is the first
representation’s format, its title the plain text’s name.
Sourcepub fn offers(&self) -> Vec<FormatId>
pub fn offers(&self) -> Vec<FormatId>
The formats it offers: its type, then its fallbacks, each once.