Trait tauri::Assets

source ·
pub trait Assets<R: Runtime>: Send + Sync + 'static {
    // Required methods
    fn get(&self, key: &AssetKey) -> Option<Cow<'_, [u8]>>;
    fn iter(&self) -> Box<dyn Iterator<Item = (&str, &[u8])> + '_>;
    fn csp_hashes(
        &self,
        html_path: &AssetKey
    ) -> Box<dyn Iterator<Item = CspHash<'_>> + '_>;

    // Provided method
    fn setup(&self, app: &App<R>) { ... }
}
Expand description

Represents a container of file assets that are retrievable during runtime.

Required Methods§

source

fn get(&self, key: &AssetKey) -> Option<Cow<'_, [u8]>>

Get the content of the passed AssetKey.

source

fn iter(&self) -> Box<dyn Iterator<Item = (&str, &[u8])> + '_>

Iterator for the assets.

source

fn csp_hashes( &self, html_path: &AssetKey ) -> Box<dyn Iterator<Item = CspHash<'_>> + '_>

Gets the hashes for the CSP tag of the HTML on the given path.

Provided Methods§

source

fn setup(&self, app: &App<R>)

Initialize the asset provider.

Implementations on Foreign Types§

source§

impl<R: Runtime> Assets<R> for EmbeddedAssets

source§

fn get(&self, key: &AssetKey) -> Option<Cow<'_, [u8]>>

source§

fn iter(&self) -> Box<dyn Iterator<Item = (&str, &[u8])> + '_>

source§

fn csp_hashes( &self, html_path: &AssetKey ) -> Box<dyn Iterator<Item = CspHash<'_>> + '_>

Implementors§

source§

impl<R: Runtime> Assets<R> for NoopAsset

Available on crate feature test only.