Constant freya_elements::attributes::cache_key::cache_key

source ยท
pub const cache_key: (&'static str, Option<&'static str>, bool);
Expand description

cache_key lets you specify an unique identifier for the given image. This will help Freya cache the image decoding, if the cache_key changes the old cache will be pruned and the image (changed or not) will be decoded again. cache_key is optinal but its recommended to be used, specialy for high quality images. You can pass any value that can be transformed into a string. Like a URL.

static RUST_LOGO: &[u8] = include_bytes!("../_docs/rust_logo.png");

fn app() -> Element {
    let image_data = static_bytes(RUST_LOGO);
    rsx!(
        image {
            image_data,
            width: "100%",
            height: "100%",
            cache_key: "rust-logo"
        }
    )
}