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: Value, title: &str, ) -> ClipItem
Sourcepub fn external_text(text: &str) -> ClipItem
pub fn external_text(text: &str) -> ClipItem
Text from outside the owner (another application’s).
Sourcepub fn title_key(self, key: &str, args: &[(&str, &str)]) -> ClipItem
pub fn title_key(self, key: &str, args: &[(&str, &str)]) -> ClipItem
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<ClipItem>
pub fn external(reprs: Vec<Repr>) -> Option<ClipItem>
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 fallback(self, format: FormatId, data: Value) -> ClipItem
pub fn fallback(self, format: FormatId, data: Value) -> ClipItem
Adds a fallback representation.
Sourcepub fn offers(&self) -> Vec<FormatId>
pub fn offers(&self) -> Vec<FormatId>
The formats it offers: its type, then its fallbacks, each once.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ClipItem
impl<'de> Deserialize<'de> for ClipItem
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ClipItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ClipItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for ClipItem
impl Serialize for ClipItem
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ClipItem
Auto Trait Implementations§
impl Freeze for ClipItem
impl RefUnwindSafe for ClipItem
impl Send for ClipItem
impl Sync for ClipItem
impl Unpin for ClipItem
impl UnsafeUnpin for ClipItem
impl UnwindSafe for ClipItem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more