pub struct ExternalDropData {
pub files: Vec<PathBuf>,
pub text: Option<String>,
pub uris: Vec<String>,
pub mime: HashMap<String, Vec<u8>>,
pub formats: Vec<String>,
}Expand description
Data delivered by an external (OS) drag-and-drop.
Platform backends populate the fields they can extract from the native
drag payload. files are real filesystem paths, text is plain UTF-8
text, uris are non-file:// URLs (e.g. https://…). mime holds any
additional raw representations keyed by MIME type, for consumers that want
the bytes verbatim.
Fields§
§files: Vec<PathBuf>Dropped filesystem paths.
text: Option<String>Dropped plain text, if any.
uris: Vec<String>Dropped non-file URLs (http, https, mailto, …).
mime: HashMap<String, Vec<u8>>Additional raw MIME representations, keyed by MIME type.
formats: Vec<String>Advertised data formats (platform MIME types / type identifiers),
available at drag-enter time even before the bytes are transferred.
On Wayland the actual files / text / uris are only filled at drop
(received over a pipe), so a drop target validates on hover from these
format strings (e.g. "text/uri-list" ⇒ a file drag). macOS / Windows
read the full payload at enter, so they fill the data directly and may
leave this empty.
Implementations§
Source§impl ExternalDropData
impl ExternalDropData
Sourcepub fn from_uri_list(list: &str) -> Self
pub fn from_uri_list(list: &str) -> Self
Build from a text/uri-list payload (RFC 2483): one URI per line,
#-prefixed comment lines ignored, CRLF line endings, percent-encoded.
file:// URIs become Self::files; everything else becomes
Self::uris. The raw list is also retained under the
text/uri-list MIME key.
Trait Implementations§
Source§impl Clone for ExternalDropData
impl Clone for ExternalDropData
Source§fn clone(&self) -> ExternalDropData
fn clone(&self) -> ExternalDropData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more