tauri

Struct 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, 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>,

Source§

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>,

Source§

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T