Struct tauri::AppHandle
pub struct AppHandle<R: Runtime = Wry> { /* fields omitted */ }
Expand description
A handle to the currently running application.
This type implements Manager
which allows for manipulation of global application items.
#
ImplementationsAppHandle<Wry>[src]#
implcreate_tao_window<F: FnOnce() -> (String, WryWindowBuilder) + Send + 'static>( &self, f: F ) -> Result<Arc<Window>>[src]#
pub fnCreate a new tao window using a callback. The event loop must be running at this point.
send_tao_window_event( &self, window_id: WindowId, message: WindowMessage ) -> Result<()>[src]#
pub fnSends a window message to the event loop.
Runtime> AppHandle<R>[src]#
impl<R:plugin<P: Plugin<R> + 'static>(&self, plugin: P) -> Result<()>[src]#
pub fnAdds a plugin to the runtime.
exit(&self, exit_code: i32)[src]#
pub fnExits the app
Runtime> AppHandle<R>[src]#
impl<R: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]#
pub fnCreates a new webview window.
path_resolver(&self) -> PathResolver[src]#
pub fnThe path resolver for the application.
global_shortcut_manager(&self) -> R::GlobalShortcutManager[src]#
pub fnGets a copy of the global shortcut manager instance.
clipboard_manager(&self) -> R::ClipboardManager[src]#
pub fnGets a copy of the clipboard manager instance.
config(&self) -> Arc<Config>[src]#
pub fnGets the app’s configuration, defined on the tauri.conf.json
file.
package_info(&self) -> &PackageInfo[src]#
pub fnGets the app’s package information.
#
Trait ImplementationsRuntime> Clone for AppHandle<R>[src]#
impl<R:clone(&self) -> Self[src]#
fnReturns a copy of the value. Read more
clone_from(&mut self, source: &Self)1.0.0[src]#
fnPerforms copy-assignment from source
. Read more
Runtime> CommandArg<'de, R> for AppHandle<R>[src]#
impl<'de, R:from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>[src]#
fnGrabs the Window
from the CommandItem
and returns the associated AppHandle
. This will never fail.
Debug + Runtime> Debug for AppHandle<R> where R::Handle: Debug, R::GlobalShortcutManager: Debug, R::ClipboardManager: Debug,[src]#
impl<R:fmt(&self, f: &mut Formatter<'_>) -> Result[src]#
fnFormats the value using the given formatter. Read more
Runtime> Manager<R> for AppHandle<R>[src]#
impl<R:config(&self) -> Arc<Config>[src]#
fnThe Config
the manager was created with.
emit_all<S: Serialize + Clone>(&self, event: &str, payload: S) -> Result<()>[src]#
fnEmits a event to all windows.
emit_to<S: Serialize + Clone>( &self, label: &str, event: &str, payload: S ) -> Result<()>[src]#
fnEmits an event to a window with the specified label.
listen_global<F>(&self, event: impl Into<String>, handler: F) -> EventHandler where F: Fn(EmittedEvent) + Send + 'static,[src]#
fnListen to a global event.
once_global<F>(&self, event: impl Into<String>, handler: F) -> EventHandler where F: Fn(EmittedEvent) + Send + 'static,[src]#
fnListen to a global event only once.
trigger_global(&self, event: &str, data: Option<String>)[src]#
fnTrigger a global event.
unlisten(&self, handler_id: EventHandler)[src]#
fnRemove an event listener.
get_window(&self, label: &str) -> Option<Window<R>>[src]#
fnFetch a single window from the manager.
windows(&self) -> HashMap<String, Window<R>>[src]#
fnFetch all managed windows.
manage<T>(&self, state: T) where T: Send + Sync + 'static,[src]#
fnAdd state
to the state managed by the application. See crate::Builder
for instructions. Read more
state<T>(&self) -> State<'_, T> where T: Send + Sync + 'static,[src]#
fnGets the managed state for the type T
. Panics if the type is not managed.
try_state<T>(&self) -> Option<State<'_, T>> where T: Send + Sync + 'static,[src]#
fnTries to get the managed state for the type T
. Returns None
if the type is not managed.
#
Auto Trait ImplementationsWry> \!RefUnwindSafe for AppHandle<R>#
impl<R =Send for AppHandle<R>#
impl<R>Sync for AppHandle<R> where <R as Runtime>::ClipboardManager: Sync, <R as Runtime>::GlobalShortcutManager: Sync, <R as Runtime>::Handle: Sync,#
impl<R>Unpin for AppHandle<R> where <R as Runtime>::ClipboardManager: Unpin, <R as Runtime>::GlobalShortcutManager: Unpin, <R as Runtime>::Handle: Unpin,#
impl<R>Wry> \!UnwindSafe for AppHandle<R>#
impl<R =#
Blanket ImplementationsAny for T where T: 'static + ?Sized,[src]#
impl<T>type_id(&self) -> TypeId[src]#
pub fnGets the TypeId
of self
. Read more
Borrow<T> for T where T: ?Sized,[src]#
impl<T>borrow(&self) -> &T[src]#
pub fnImmutably borrows from an owned value. Read more
BorrowMut<T> for T where T: ?Sized,[src]#
impl<T>borrow_mut(&mut self) -> &mutT[src]#
pub fnMutably borrows from an owned value. Read more
From<T> for T[src]#
impl<T>from(t: T) -> T[src]#
pub fnPerforms the conversion.
Into<U> for T where U: From<T>,[src]#
impl<T, U>into(self) -> U[src]#
pub fnPerforms the conversion.
ToOwned for T where T: Clone,[src]#
impl<T>Owned = T#
typeThe resulting type after obtaining ownership.
to_owned(&self) -> T[src]#
pub fnCreates owned data from borrowed data, usually by cloning. Read more
clone_into(&self, target: &mutT)[src]#
pub fn🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
TryFrom<U> for T where U: Into<T>,[src]#
impl<T, U>Error = Infallible#
typeThe type returned in the event of a conversion error.
try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]#
pub fnPerforms the conversion.
TryInto<U> for T where U: TryFrom<T>,[src]#
impl<T, U>Error = <U as TryFrom<T>>::Error#
typeThe type returned in the event of a conversion error.
try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]#
pub fnPerforms the conversion.