pub struct ClipboardItem {
pub entries: Vec<ClipboardEntry>,
}Expand description
A clipboard item that should be copied to the clipboard
Fields§
§entries: Vec<ClipboardEntry>The entries in this clipboard item.
Implementations§
Source§impl ClipboardItem
impl ClipboardItem
Sourcepub fn new_string(text: String) -> Self
pub fn new_string(text: String) -> Self
Create a new ClipboardItem::String with no associated metadata
Sourcepub fn new_string_with_metadata(text: String, metadata: String) -> Self
pub fn new_string_with_metadata(text: String, metadata: String) -> Self
Create a new ClipboardItem::String with the given text and associated metadata
Sourcepub fn new_string_with_json_metadata<T: Serialize>(
text: String,
metadata: T,
) -> Self
pub fn new_string_with_json_metadata<T: Serialize>( text: String, metadata: T, ) -> Self
Create a new ClipboardItem::String with the given text and associated metadata
Sourcepub fn new_image(image: &Image) -> Self
pub fn new_image(image: &Image) -> Self
Create a new ClipboardItem::Image with the given image with no associated metadata
Sourcepub fn text(&self) -> Option<String>
pub fn text(&self) -> Option<String>
Concatenates together all the ClipboardString entries in the item. Returns None if there were no ClipboardString entries.
Sourcepub fn metadata(&self) -> Option<&String>
pub fn metadata(&self) -> Option<&String>
If this item is one ClipboardEntry::String, returns its metadata.
Sourcepub fn entries(&self) -> &[ClipboardEntry]
pub fn entries(&self) -> &[ClipboardEntry]
Get the item’s entries
Sourcepub fn into_entries(self) -> impl Iterator<Item = ClipboardEntry>
pub fn into_entries(self) -> impl Iterator<Item = ClipboardEntry>
Get owned versions of the item’s entries
Trait Implementations§
Source§impl Clone for ClipboardItem
impl Clone for ClipboardItem
Source§fn clone(&self) -> ClipboardItem
fn clone(&self) -> ClipboardItem
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClipboardItem
impl Debug for ClipboardItem
Source§impl From<ClipboardEntry> for ClipboardItem
impl From<ClipboardEntry> for ClipboardItem
Source§fn from(value: ClipboardEntry) -> Self
fn from(value: ClipboardEntry) -> Self
Converts to this type from the input type.
Source§impl From<Image> for ClipboardItem
impl From<Image> for ClipboardItem
Source§impl From<String> for ClipboardItem
impl From<String> for ClipboardItem
Source§impl PartialEq for ClipboardItem
impl PartialEq for ClipboardItem
Source§fn eq(&self, other: &ClipboardItem) -> bool
fn eq(&self, other: &ClipboardItem) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for ClipboardItem
impl StructuralPartialEq for ClipboardItem
Auto Trait Implementations§
impl Freeze for ClipboardItem
impl RefUnwindSafe for ClipboardItem
impl Send for ClipboardItem
impl Sync for ClipboardItem
impl Unpin for ClipboardItem
impl UnsafeUnpin for ClipboardItem
impl UnwindSafe for ClipboardItem
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Converts
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>
Converts
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