mirror of
https://github.com/tauri-apps/tauri.git
synced 2025-01-02 16:09:49 +03:00
feat(core): finish mutable getters for Context
(#1814)
This commit is contained in:
parent
39f8f26916
commit
754c2e766a
9
.changes/context-mutable-methods.md
Normal file
9
.changes/context-mutable-methods.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
"tauri": patch
|
||||
---
|
||||
|
||||
Expose mutable getters for the rest of the public `Context` getters.
|
||||
* `pub fn assets_mut(&mut self) -> &mut Arc<A>`
|
||||
* `pub fn default_window_icon_mut(&mut self) -> &mut Option<Vec<u8>>`
|
||||
* `pub fn system_tray_icon_mut(&mut self) -> &mut Option<Icon>`
|
||||
* `pub fn package_info_mut(&mut self) -> &mut tauri::api::PackageInfo`
|
@ -154,24 +154,48 @@ impl<A: Assets> Context<A> {
|
||||
self.assets.clone()
|
||||
}
|
||||
|
||||
/// A mutable reference to the assets to be served directly by Tauri.
|
||||
#[inline(always)]
|
||||
pub fn assets_mut(&mut self) -> &mut Arc<A> {
|
||||
&mut self.assets
|
||||
}
|
||||
|
||||
/// The default window icon Tauri should use when creating windows.
|
||||
#[inline(always)]
|
||||
pub fn default_window_icon(&self) -> Option<&[u8]> {
|
||||
self.default_window_icon.as_deref()
|
||||
}
|
||||
|
||||
/// The icon to use use on the system tray UI.
|
||||
/// A mutable reference to the default window icon Tauri should use when creating windows.
|
||||
#[inline(always)]
|
||||
pub fn default_window_icon_mut(&mut self) -> &mut Option<Vec<u8>> {
|
||||
&mut self.default_window_icon
|
||||
}
|
||||
|
||||
/// The icon to use on the system tray UI.
|
||||
#[inline(always)]
|
||||
pub fn system_tray_icon(&self) -> Option<&Icon> {
|
||||
self.system_tray_icon.as_ref()
|
||||
}
|
||||
|
||||
/// A mutable reference to the icon to use on the system tray UI.
|
||||
#[inline(always)]
|
||||
pub fn system_tray_icon_mut(&mut self) -> &mut Option<Icon> {
|
||||
&mut self.system_tray_icon
|
||||
}
|
||||
|
||||
/// Package information.
|
||||
#[inline(always)]
|
||||
pub fn package_info(&self) -> &crate::api::PackageInfo {
|
||||
&self.package_info
|
||||
}
|
||||
|
||||
/// A mutable reference to the package information.
|
||||
#[inline(always)]
|
||||
pub fn package_info_mut(&mut self) -> &mut crate::api::PackageInfo {
|
||||
&mut self.package_info
|
||||
}
|
||||
|
||||
/// Create a new [`Context`] from the minimal required items.
|
||||
#[inline(always)]
|
||||
pub fn new(
|
||||
|
Loading…
Reference in New Issue
Block a user