pub struct Context<R: Runtime = Wry> {
pub assets: Box<dyn Assets<R>>,
/* private fields */
}
Expand description
User supplied data required inside of a Tauri application.
§Stability
This is the output of the generate_context
macro, and is not considered part of the stable API.
Unless you know what you are doing and are prepared for this type to have breaking changes, do not create it yourself.
Fields§
§assets: Box<dyn Assets<R>>
Asset provider.
Implementations§
Source§impl<R: Runtime> Context<R>
impl<R: Runtime> Context<R>
Sourcepub fn config_mut(&mut self) -> &mut Config
pub fn config_mut(&mut self) -> &mut Config
A mutable reference to the config the application was prepared with.
Sourcepub fn set_assets(&mut self, assets: Box<dyn Assets<R>>) -> Box<dyn Assets<R>>
pub fn set_assets(&mut self, assets: Box<dyn Assets<R>>) -> Box<dyn Assets<R>>
Replace the Assets
implementation and returns the previous value so you can use it as a fallback if desired.
Sourcepub fn default_window_icon(&self) -> Option<&Image<'_>>
pub fn default_window_icon(&self) -> Option<&Image<'_>>
The default window icon Tauri should use when creating windows.
Sourcepub fn set_default_window_icon(&mut self, icon: Option<Image<'static>>)
pub fn set_default_window_icon(&mut self, icon: Option<Image<'static>>)
Set the default window icon Tauri should use when creating windows.
Sourcepub fn tray_icon(&self) -> Option<&Image<'_>>
Available on desktop
and crate feature tray-icon
only.
pub fn tray_icon(&self) -> Option<&Image<'_>>
desktop
and crate feature tray-icon
only.The icon to use on the tray icon.
Sourcepub fn set_tray_icon(&mut self, icon: Option<Image<'static>>)
Available on desktop
and crate feature tray-icon
only.
pub fn set_tray_icon(&mut self, icon: Option<Image<'static>>)
desktop
and crate feature tray-icon
only.Set the icon to use on the tray icon.
Sourcepub fn package_info(&self) -> &PackageInfo
pub fn package_info(&self) -> &PackageInfo
Package information.
Sourcepub fn package_info_mut(&mut self) -> &mut PackageInfo
pub fn package_info_mut(&mut self) -> &mut PackageInfo
A mutable reference to the package information.
Sourcepub fn new(
config: Config,
assets: Box<dyn Assets<R>>,
default_window_icon: Option<Image<'static>>,
app_icon: Option<Vec<u8>>,
package_info: PackageInfo,
pattern: Pattern,
runtime_authority: RuntimeAuthority,
plugin_global_api_scripts: Option<&'static [&'static str]>,
) -> Self
pub fn new( config: Config, assets: Box<dyn Assets<R>>, default_window_icon: Option<Image<'static>>, app_icon: Option<Vec<u8>>, package_info: PackageInfo, pattern: Pattern, runtime_authority: RuntimeAuthority, plugin_global_api_scripts: Option<&'static [&'static str]>, ) -> Self
Create a new Context
from the minimal required items.