pub trait RuntimeHandle<T: UserEvent>:
Debug
+ Clone
+ Send
+ Sync
+ Sized
+ 'static {
type Runtime: Runtime<T, Handle = Self>;
Show 14 methods
// Required methods
fn create_proxy(&self) -> <Self::Runtime as Runtime<T>>::EventLoopProxy;
fn request_exit(&self, code: i32) -> Result<()>;
fn create_window<F: Fn(RawWindow<'_>) + Send + 'static>(
&self,
pending: PendingWindow<T, Self::Runtime>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self::Runtime>>;
fn create_webview(
&self,
window_id: WindowId,
pending: PendingWebview<T, Self::Runtime>,
) -> Result<DetachedWebview<T, Self::Runtime>>;
fn run_on_main_thread<F: FnOnce() + Send + 'static>(
&self,
f: F,
) -> Result<()>;
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>;
fn primary_monitor(&self) -> Result<Option<Monitor>>;
fn monitor_from_point(&self, x: f64, y: f64) -> Result<Option<Monitor>>;
fn available_monitors(&self) -> Result<Vec<Monitor>>;
fn cursor_position(&self) -> Result<PhysicalPosition<f64>>;
fn set_theme(&self, theme: Option<Theme>);
fn set_device_event_filter(&self, filter: DeviceEventFilter);
fn custom_scheme_url(&self, scheme: &str, https: bool) -> String;
fn webview_version(&self) -> Result<String>;
}Expand description
A Send handle to the runtime.
Required Associated Types§
Required Methods§
Sourcefn create_proxy(&self) -> <Self::Runtime as Runtime<T>>::EventLoopProxy
fn create_proxy(&self) -> <Self::Runtime as Runtime<T>>::EventLoopProxy
Creates an EventLoopProxy that can be used to dispatch user events to the main event loop.
Sourcefn request_exit(&self, code: i32) -> Result<()>
fn request_exit(&self, code: i32) -> Result<()>
Requests an exit of the event loop.
Sourcefn create_window<F: Fn(RawWindow<'_>) + Send + 'static>(
&self,
pending: PendingWindow<T, Self::Runtime>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self::Runtime>>
fn create_window<F: Fn(RawWindow<'_>) + Send + 'static>( &self, pending: PendingWindow<T, Self::Runtime>, after_window_creation: Option<F>, ) -> Result<DetachedWindow<T, Self::Runtime>>
Create a new window.
Sourcefn create_webview(
&self,
window_id: WindowId,
pending: PendingWebview<T, Self::Runtime>,
) -> Result<DetachedWebview<T, Self::Runtime>>
fn create_webview( &self, window_id: WindowId, pending: PendingWebview<T, Self::Runtime>, ) -> Result<DetachedWebview<T, Self::Runtime>>
Create a new webview.
Sourcefn run_on_main_thread<F: FnOnce() + Send + 'static>(&self, f: F) -> Result<()>
fn run_on_main_thread<F: FnOnce() + Send + 'static>(&self, f: F) -> Result<()>
Run a task on the main thread.
Sourcefn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
Get a handle to the display controller of the windowing system.
Sourcefn primary_monitor(&self) -> Result<Option<Monitor>>
fn primary_monitor(&self) -> Result<Option<Monitor>>
Returns the primary monitor of the system.
Returns None if it can’t identify any monitor as a primary one.
Sourcefn monitor_from_point(&self, x: f64, y: f64) -> Result<Option<Monitor>>
fn monitor_from_point(&self, x: f64, y: f64) -> Result<Option<Monitor>>
Returns the monitor that contains the given point.
Sourcefn available_monitors(&self) -> Result<Vec<Monitor>>
fn available_monitors(&self) -> Result<Vec<Monitor>>
Returns the list of all the monitors available on the system.
Sourcefn cursor_position(&self) -> Result<PhysicalPosition<f64>>
fn cursor_position(&self) -> Result<PhysicalPosition<f64>>
Get the cursor position relative to the top-left hand corner of the desktop.
Sourcefn set_device_event_filter(&self, filter: DeviceEventFilter)
fn set_device_event_filter(&self, filter: DeviceEventFilter)
Change the device event filter mode.
See Runtime::set_device_event_filter for details.
§Platform-specific
See Runtime::set_device_event_filter for details.
Sourcefn custom_scheme_url(&self, scheme: &str, https: bool) -> String
fn custom_scheme_url(&self, scheme: &str, https: bool) -> String
Returns the URL a custom scheme is served from,
e.g. tauri://localhost or http://tauri.localhost.
The format is entirely up to the runtime. Tauri never assumes a particular scheme or host layout: every custom protocol URL it builds or compares against goes through this function, and the asset path of an incoming custom protocol request is always taken from its URI path.
scheme is usually a registered protocol name such as tauri, ipc or asset, but it can
also be the literal placeholder {protocol}, which Tauri uses to build the URL template
injected into the webview (the frontend expands it in convertFileSrc). Implementations must
therefore interpolate scheme verbatim, without validating, escaping or normalizing it.
https reflects crate::webview::WebviewAttributes::use_https_scheme; runtimes that do not
serve custom protocols over http(s) can ignore it.
Sourcefn webview_version(&self) -> Result<String>
fn webview_version(&self) -> Result<String>
Returns the version of the underlying webview engine.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".