Struct tauri::Context

source ·
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>

source

pub fn config(&self) -> &Config

The config the application was prepared with.

source

pub fn config_mut(&mut self) -> &mut Config

A mutable reference to the config the application was prepared with.

source

pub fn assets(&self) -> &dyn Assets<R>

The assets to be served directly by Tauri.

source

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.

source

pub fn default_window_icon(&self) -> Option<&Image<'_>>

The default window icon Tauri should use when creating windows.

source

pub fn set_default_window_icon(&mut self, icon: Option<Image<'static>>)

Set the default window icon Tauri should use when creating windows.

source

pub fn tray_icon(&self) -> Option<&Image<'_>>

Available on desktop and crate feature tray-icon only.

The icon to use on the tray icon.

source

pub fn set_tray_icon(&mut self, icon: Option<Image<'static>>)

Available on desktop and crate feature tray-icon only.

Set the icon to use on the tray icon.

source

pub fn package_info(&self) -> &PackageInfo

Package information.

source

pub fn package_info_mut(&mut self) -> &mut PackageInfo

A mutable reference to the package information.

source

pub fn pattern(&self) -> &Pattern

The application pattern.

source

pub fn new( config: Config, assets: Box<dyn Assets<R>>, default_window_icon: Option<Image<'static>>, app_icon: Option<Vec<u8>>, package_info: PackageInfo, info_plist: (), pattern: Pattern, runtime_authority: RuntimeAuthority, plugin_global_api_scripts: Option<&'static [&'static str]> ) -> Self

Create a new Context from the minimal required items.

Trait Implementations§

source§

impl<R: Runtime> Debug for Context<R>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R = Wry<EventLoopMessage>> !Freeze for Context<R>

§

impl<R = Wry<EventLoopMessage>> !RefUnwindSafe for Context<R>

§

impl<R> Send for Context<R>

§

impl<R> Sync for Context<R>

§

impl<R> Unpin for Context<R>

§

impl<R = Wry<EventLoopMessage>> !UnwindSafe for Context<R>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.