tauri

Trait Assets

Source
pub trait Assets<R: Runtime>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn get(&self, key: &AssetKey) -> Option<Cow<'_, [u8]>>;
    fn iter(&self) -> Box<AssetsIter<'_>>;
    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<AssetsIter<'_>>

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<AssetsIter<'_>>

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.