Skip to main content

Struct tauri::App

pub struct App<R: Runtime = Wry> { /* fields omitted */ }

Expand description

The instance of the currently running application.

This type implements Manager which allows for manipulation of global application items.

Implementations#

impl<R: Runtime> App<R>[src]#

pub fn create_window<F>( &self, label: impl Into<String>, url: WindowUrl, setup: F ) -> Result<()> where F: FnOnce(<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes) -> (<R::Dispatcher as Dispatch>::WindowBuilder, WebviewAttributes),[src]#

Creates a new webview window.

pub fn path_resolver(&self) -> PathResolver[src]#

The path resolver for the application.

pub fn global_shortcut_manager(&self) -> R::GlobalShortcutManager[src]#

Gets a copy of the global shortcut manager instance.

pub fn clipboard_manager(&self) -> R::ClipboardManager[src]#

Gets a copy of the clipboard manager instance.

pub fn config(&self) -> Arc<Config>[src]#

Gets the app’s configuration, defined on the tauri.conf.json file.

pub fn package_info(&self) -> &PackageInfo[src]#

Gets the app’s package information.

impl<R: Runtime> App<R>[src]#

pub fn handle(&self) -> AppHandle<R>[src]#

Gets a handle to the application instance.

pub fn run<F: Fn(&AppHandle<R>, Event) + 'static>(self, callback: F)[src]#

Runs the application.

Trait Implementations#

impl<R: Debug + Runtime> Debug for App<R> where R::GlobalShortcutManager: Debug, R::ClipboardManager: Debug,[src]#

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

Formats the value using the given formatter. Read more

impl<R: Runtime> Manager<R> for App<R>[src]#

fn config(&self) -> Arc<Config>[src]#

The Config the manager was created with.

fn emit_all<S: Serialize + Clone>(&self, event: &str, payload: S) -> Result<()>[src]#

Emits a event to all windows.

fn emit_to<S: Serialize + Clone>( &self, label: &str, event: &str, payload: S ) -> Result<()>[src]#

Emits an event to a window with the specified label.

fn listen_global<F>(&self, event: impl Into<String>, handler: F) -> EventHandler where F: Fn(EmittedEvent) + Send + 'static,[src]#

Listen to a global event.

fn once_global<F>(&self, event: impl Into<String>, handler: F) -> EventHandler where F: Fn(EmittedEvent) + Send + 'static,[src]#

Listen to a global event only once.

fn trigger_global(&self, event: &str, data: Option<String>)[src]#

Trigger a global event.

fn unlisten(&self, handler_id: EventHandler)[src]#

Remove an event listener.

fn get_window(&self, label: &str) -> Option<Window<R>>[src]#

Fetch a single window from the manager.

fn windows(&self) -> HashMap<String, Window<R>>[src]#

Fetch all managed windows.

fn manage<T>(&self, state: T) where T: Send + Sync + 'static,[src]#

Add state to the state managed by the application. See crate::Builder for instructions. Read more

fn state<T>(&self) -> State<'_, T> where T: Send + Sync + 'static,[src]#

Gets the managed state for the type T. Panics if the type is not managed.

fn try_state<T>(&self) -> Option<State<'_, T>> where T: Send + Sync + 'static,[src]#

Tries to get the managed state for the type T. Returns None if the type is not managed.

Auto Trait Implementations#

impl<R = Wry> \!RefUnwindSafe for App<R>#

impl<R> Send for App<R> where R: Send,#

impl<R> Sync for App<R> where R: Sync, <R as Runtime>::ClipboardManager: Sync, <R as Runtime>::GlobalShortcutManager: Sync, <R as Runtime>::Handle: Sync,#

impl<R> Unpin for App<R> where R: Unpin, <R as Runtime>::ClipboardManager: Unpin, <R as Runtime>::GlobalShortcutManager: Unpin, <R as Runtime>::Handle: Unpin,#

impl<R = Wry> \!UnwindSafe for App<R>#

Blanket Implementations#

impl<T> Any for T where T: 'static + ?Sized,[src]#

pub fn type_id(&self) -> TypeId[src]#

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where T: ?Sized,[src]#

pub fn borrow(&self) -> &T[src]#

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where T: ?Sized,[src]#

pub fn borrow_mut(&mut self) -> &mutT[src]#

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]#

pub fn from(t: T) -> T[src]#

Performs the conversion.

impl<T, U> Into<U> for T where U: From<T>,[src]#

pub fn into(self) -> U[src]#

Performs the conversion.

impl<T, U> TryFrom<U> for T where U: Into<T>,[src]#

type Error = Infallible#

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]#

Performs the conversion.

impl<T, U> TryInto<U> for T where U: TryFrom<T>,[src]#

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

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]#

Performs the conversion.

impl<V, T> VZip<V> for T where V: MultiLane<T>,#

pub fn vzip(self) -> V#