refactor: remove unneeded mime types from ClipboardStoredData
This commit is contained in:
parent
20e7cbedf5
commit
c3e9e794b9
2 changed files with 3 additions and 8 deletions
|
|
@ -38,12 +38,7 @@ impl<T: AsMimeTypes + ?Sized> AsMimeTypes for Box<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data that can be stored to the clipboard.
|
/// Data that can be stored to the clipboard.
|
||||||
pub struct ClipboardStoreData<T> {
|
pub struct ClipboardStoreData<T>(pub T);
|
||||||
/// Clipboard data.
|
|
||||||
pub data: T,
|
|
||||||
/// Available mime types for the clipboard data.
|
|
||||||
pub available_mime_types: Vec<Cow<'static, str>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub struct Error;
|
pub struct Error;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use crate::{ClipboardLoadData, ClipboardStoreData};
|
||||||
|
|
||||||
impl<T: crate::AsMimeTypes> AsMimeTypes for ClipboardStoreData<T> {
|
impl<T: crate::AsMimeTypes> AsMimeTypes for ClipboardStoreData<T> {
|
||||||
fn available(&self) -> std::borrow::Cow<'static, [MimeType]> {
|
fn available(&self) -> std::borrow::Cow<'static, [MimeType]> {
|
||||||
self.data
|
self.0
|
||||||
.available()
|
.available()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|m| MimeType::Other(m.clone().into()))
|
.map(|m| MimeType::Other(m.clone().into()))
|
||||||
|
|
@ -15,7 +15,7 @@ impl<T: crate::AsMimeTypes> AsMimeTypes for ClipboardStoreData<T> {
|
||||||
&self,
|
&self,
|
||||||
mime_type: &MimeType,
|
mime_type: &MimeType,
|
||||||
) -> Option<std::borrow::Cow<'static, [u8]>> {
|
) -> Option<std::borrow::Cow<'static, [u8]>> {
|
||||||
self.data.as_bytes(mime_type.as_ref())
|
self.0.as_bytes(mime_type.as_ref())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue