#[non_exhaustive]pub enum SendData {
Uris(Vec<String>),
String(String),
Bytes(Vec<u8>),
}Expand description
Kinds of data that can be sent via a DataTransfer.
Some kinds of data cannot be represented by just a binary blob in a cross-platform way. File URIs on Windows and macOS are represented as arrays of strings, and strings have different encoding on different platforms. To allow this to be represented, we allow supplying strings and URIs separately from binary blobs.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Uris(Vec<String>)
List of URIs.
These should conform to RFC 3986.
If you just want to send file paths, see SendData::from_file_paths.
Note that SendData implements From<String> and From<Vec<u8>>, but not
From<Vec<String>>, as it is not necessarily obvious to a reader that Vec<String>
will be interpreted as a URI list. However, it does implement From<Url>,
if you are using the url crate.
String(String)
String
This can also be constructed with the From<String> implementation.
Bytes(Vec<u8>)
Binary blob
This can also be constructed with the From<Vec<u8>> implementation.
Implementations§
Source§impl SendData
impl SendData
Sourcepub fn from_file_paths<I>(paths: I) -> Option<Self>
pub fn from_file_paths<I>(paths: I) -> Option<Self>
Create SendData::Uris from an iterator of Paths.
All paths must be absolute, and on Windows must include either a drive prefix (e.g. C:\)
or a UNC prefix (\\). See documentation for url::Url::from_file_path.