load_resource

Function load_resource 

Source
fn load_resource(
    session: &Session,
    load_options: &LoadOptions,
    aurl: &AllowedUrl,
    cancellable: Option<&Cancellable>,
) -> Result<Resource, LoadingError>
Expand description

Loads the entire contents of a URL, sniffs them, and decodes them as a Resource for an SVG or raster image.

Assumes that gio’s content-sniffing machinery is working correctly. Anything that doesn’t sniff like an SVG document will be decoded as a raster image.

This handles data: URLs correctly, by decoding them into binary data, and then sniffing it or using the declared MIME type in the data: URL itself.