Trait asset_derive::Asset

source ·
pub trait Asset {
    // Required methods
    fn fetch(&self) -> Vec<u8>;
    fn fetch_static(&self) -> &'static [u8] ;
}
Expand description

Trait to be derived by asset-derive macro.

Required Methods§

source

fn fetch(&self) -> Vec<u8>

Method responsible for fetching requested resource.

Example
let data = Icon::Select.fetch();
source

fn fetch_static(&self) -> &'static [u8]

Method responsible for fetching requested static resource.

NOTE: this returns an Option<&'static [u8]> because it will only be useable for compile-time loaded resources. Dynamic will return None.

Example
let static_data = Icon::Select.fetch_static().unwrap();

Implementors§