pub struct MimePayload {
pub kinds: SmallVec<[(MimeKind, Vec<u8>); 4]>,
}Expand description
A MIME-typed multi-format payload.
Used by both the clipboard ([lumen-os-clipboard]) and drag-and-drop
([lumen-os-dnd]) - one payload can carry multiple representations
of the same data (the convention shared by QMimeData and
GdkContentProvider). Targets read whichever MIME they understand.
Fields§
§kinds: SmallVec<[(MimeKind, Vec<u8>); 4]>Stored representations in author-insertion order; recipients pick the first kind they understand.
Implementations§
Source§impl MimePayload
impl MimePayload
Sourcepub fn with(self, kind: MimeKind, bytes: Vec<u8>) -> Self
pub fn with(self, kind: MimeKind, bytes: Vec<u8>) -> Self
Push an (kind, bytes) entry. Returns self for builder-style
chaining.
Sourcepub fn get(&self, kind: &MimeKind) -> Option<&[u8]>
pub fn get(&self, kind: &MimeKind) -> Option<&[u8]>
Look up the first entry matching kind. Returns None when not
carried.
Trait Implementations§
Source§impl Clone for MimePayload
impl Clone for MimePayload
Source§fn clone(&self) -> MimePayload
fn clone(&self) -> MimePayload
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 MimePayload
impl Debug for MimePayload
Source§impl Default for MimePayload
impl Default for MimePayload
Source§fn default() -> MimePayload
fn default() -> MimePayload
Returns the “default value” for a type. Read more
Source§impl From<&str> for MimePayload
impl From<&str> for MimePayload
Source§impl From<String> for MimePayload
impl From<String> for MimePayload
Source§impl PartialEq for MimePayload
impl PartialEq for MimePayload
Source§fn eq(&self, other: &MimePayload) -> bool
fn eq(&self, other: &MimePayload) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for MimePayload
impl StructuralPartialEq for MimePayload
Auto Trait Implementations§
impl Freeze for MimePayload
impl RefUnwindSafe for MimePayload
impl Send for MimePayload
impl Sync for MimePayload
impl Unpin for MimePayload
impl UnsafeUnpin for MimePayload
impl UnwindSafe for MimePayload
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