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
.
Resolves to the embedded asset that is part of the app
in dev when devUrl
points to a folder in your filesystem
or in production when frontendDist
points to your frontend assets.
Fallbacks to reading the asset from the [distDir] folder so the behavior is consistent in development. 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
: Iftrue
when usingPattern::Isolation
, the csp header will containhttps://tauri.localhost
instead 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