pub trait ResourceUrlHandler {
// Required method
fn read_resource(&self, url: &Url) -> Result<MimeData>;
}Expand description
Handle resource URLs.
See DispatchingResourceHandler for a resource handler which dispatches
to a list of handlers, and FileResourceHandler for a resource handler for
local files.
For remote URLs implement this handler on top of a suitable crate for network
requests, e.q. reqwest or curl.
Required Methods§
Sourcefn read_resource(&self, url: &Url) -> Result<MimeData>
fn read_resource(&self, url: &Url) -> Result<MimeData>
Read a resource.
Read data from the given url, and return the data and its associated mime type if known,
or any IO error which occurred while reading from the resource.
Alternatively, return an IO error with ErrorKind::Unsupported to indicate that the
given url is not supported by this resource handler. In this case a higher level
resource handler may try a different handler.