Struct tauri::Context

source ·
pub struct Context<A: Assets> { /* 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.

Implementations§

source§

impl<A: Assets> Context<A>

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) -> &A

The assets to be served directly by Tauri.

source

pub fn assets_mut(&mut self) -> &mut A

A mutable reference to the assets to be served directly by Tauri.

source

pub fn default_window_icon(&self) -> Option<&Icon>

The default window icon Tauri should use when creating windows.

source

pub fn default_window_icon_mut(&mut self) -> &mut Option<Icon>

A mutable reference to the default window icon Tauri should use when creating windows.

source

pub fn tray_icon(&self) -> Option<&Icon>

Available on desktop and crate feature tray-icon only.

The icon to use on the system tray UI.

source

pub fn tray_icon_mut(&mut self) -> &mut Option<Icon>

Available on desktop and crate feature tray-icon only.

A mutable reference to 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<A>, default_window_icon: Option<Icon>, app_icon: Option<Vec<u8>>, package_info: PackageInfo, info_plist: (), pattern: Pattern ) -> Self

Create a new Context from the minimal required items.

source

pub fn set_tray_icon(&mut self, icon: Icon)

Available on desktop and crate feature tray-icon only.

Sets the app tray icon.

Trait Implementations§

source§

impl<A: Assets> Debug for Context<A>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<A> RefUnwindSafe for Context<A>
where A: RefUnwindSafe,

§

impl<A> Send for Context<A>

§

impl<A> Sync for Context<A>

§

impl<A> Unpin for Context<A>

§

impl<A> UnwindSafe for Context<A>
where A: UnwindSafe,

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more