pub struct AssetResolver<R: Runtime> { /* private fields */ }Expand description
The asset resolver is a helper to access the [tauri_utils::assets::Assets] interface.
Implementations§
Source§impl<R: Runtime> AssetResolver<R>
impl<R: Runtime> AssetResolver<R>
Sourcepub fn get(&self, path: String) -> Option<Asset>
pub fn get(&self, path: String) -> Option<Asset>
Gets the app asset associated with the given path.
By default it tries to infer your application’s URL scheme in production by checking if all webviews
were configured with crate::webview::WebviewBuilder::use_https_scheme or tauri.conf.json > app > windows > useHttpsScheme.
If you are resolving an asset for a webview with a more dynamic configuration, see AssetResolver::get_for_scheme.
In production, this resolves to the embedded asset bundled in the app executable
which contains your frontend assets in frontendDist during build time.
In dev mode, if devUrl is set, we don’t bundle the assets to reduce re-builds,
and this will fall back to read from frontendDist directly.
Note that the dist directory must exist so you might need to build your frontend assets first.
Sourcepub fn get_for_scheme(
&self,
path: String,
use_https_scheme: bool,
) -> Option<Asset>
pub fn get_for_scheme( &self, path: String, use_https_scheme: bool, ) -> Option<Asset>
Same as AssetResolver::get but resolves the custom protocol scheme based on a parameter.
use_https_scheme: Iftruewhen usingPattern::Isolation, the csp header will containhttps://tauri.localhostinstead ofhttp://tauri.localhost
Sourcepub fn iter(&self) -> Box<AssetsIter<'_>>
pub fn iter(&self) -> Box<AssetsIter<'_>>
Iterate on all assets.
Trait Implementations§
Source§impl<R: Clone + Runtime> Clone for AssetResolver<R>
impl<R: Clone + Runtime> Clone for AssetResolver<R>
Source§fn clone(&self) -> AssetResolver<R>
fn clone(&self) -> AssetResolver<R>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more