Trait tauri_runtime::Runtime
source · pub trait Runtime<T: UserEvent>: Debug + Sized + 'static {
type Dispatcher: Dispatch<T, Runtime = Self>;
type Handle: RuntimeHandle<T, Runtime = Self>;
type GlobalShortcutManager: GlobalShortcutManager;
type ClipboardManager: ClipboardManager;
type TrayHandler: TrayHandle;
type EventLoopProxy: EventLoopProxy<T>;
// Required methods
fn new() -> Result<Self>;
fn create_proxy(&self) -> Self::EventLoopProxy;
fn handle(&self) -> Self::Handle;
fn global_shortcut_manager(&self) -> Self::GlobalShortcutManager;
fn clipboard_manager(&self) -> Self::ClipboardManager;
fn create_window(
&self,
pending: PendingWindow<T, Self>
) -> Result<DetachedWindow<T, Self>>;
fn system_tray(&self, system_tray: SystemTray) -> Result<Self::TrayHandler>;
fn on_system_tray_event<F: Fn(TrayId, &SystemTrayEvent) + Send + 'static>(
&mut self,
f: F
);
fn set_activation_policy(&mut self, activation_policy: ActivationPolicy);
fn run_iteration<F: Fn(RunEvent<T>) + 'static>(
&mut self,
callback: F
) -> RunIteration;
fn run<F: FnMut(RunEvent<T>) + 'static>(self, callback: F);
}
Expand description
The webview runtime interface.
Required Associated Types§
sourcetype Dispatcher: Dispatch<T, Runtime = Self>
type Dispatcher: Dispatch<T, Runtime = Self>
The message dispatcher.
sourcetype Handle: RuntimeHandle<T, Runtime = Self>
type Handle: RuntimeHandle<T, Runtime = Self>
The runtime handle type.
sourcetype GlobalShortcutManager: GlobalShortcutManager
type GlobalShortcutManager: GlobalShortcutManager
The global shortcut manager type.
sourcetype ClipboardManager: ClipboardManager
type ClipboardManager: ClipboardManager
The clipboard manager type.
sourcetype TrayHandler: TrayHandle
type TrayHandler: TrayHandle
The tray handler type.
sourcetype EventLoopProxy: EventLoopProxy<T>
type EventLoopProxy: EventLoopProxy<T>
The proxy type.
Required Methods§
sourcefn create_proxy(&self) -> Self::EventLoopProxy
fn create_proxy(&self) -> Self::EventLoopProxy
Creates an EventLoopProxy
that can be used to dispatch user events to the main event loop.
sourcefn global_shortcut_manager(&self) -> Self::GlobalShortcutManager
fn global_shortcut_manager(&self) -> Self::GlobalShortcutManager
Gets the global shortcut manager.
sourcefn clipboard_manager(&self) -> Self::ClipboardManager
fn clipboard_manager(&self) -> Self::ClipboardManager
Gets the clipboard manager.
sourcefn create_window(
&self,
pending: PendingWindow<T, Self>
) -> Result<DetachedWindow<T, Self>>
fn create_window( &self, pending: PendingWindow<T, Self> ) -> Result<DetachedWindow<T, Self>>
Create a new webview window.
sourcefn system_tray(&self, system_tray: SystemTray) -> Result<Self::TrayHandler>
fn system_tray(&self, system_tray: SystemTray) -> Result<Self::TrayHandler>
Available on crate feature
system-tray
only.Adds the icon to the system tray with the specified menu items.
sourcefn on_system_tray_event<F: Fn(TrayId, &SystemTrayEvent) + Send + 'static>(
&mut self,
f: F
)
fn on_system_tray_event<F: Fn(TrayId, &SystemTrayEvent) + Send + 'static>( &mut self, f: F )
Available on crate feature
system-tray
only.Registers a system tray event handler.
sourcefn set_activation_policy(&mut self, activation_policy: ActivationPolicy)
fn set_activation_policy(&mut self, activation_policy: ActivationPolicy)
Available on macOS only.
Sets the activation policy for the application. It is set to NSApplicationActivationPolicyRegular
by default.
sourcefn run_iteration<F: Fn(RunEvent<T>) + 'static>(
&mut self,
callback: F
) -> RunIteration
fn run_iteration<F: Fn(RunEvent<T>) + 'static>( &mut self, callback: F ) -> RunIteration
Runs the one step of the webview runtime event loop and returns control flow to the caller.