pub trait Runtime<T: UserEvent>:
Debug
+ Sized
+ 'static {
type WindowDispatcher: WindowDispatch<T, Runtime = Self>;
type WebviewDispatcher: WebviewDispatch<T, Runtime = Self>;
type Handle: RuntimeHandle<T, Runtime = Self>;
type EventLoopProxy: EventLoopProxy<T>;
Show 14 methods
// Required methods
fn new(args: RuntimeInitArgs) -> Result<Self>;
fn new_any_thread(args: RuntimeInitArgs) -> Result<Self>;
fn create_proxy(&self) -> Self::EventLoopProxy;
fn handle(&self) -> Self::Handle;
fn create_window<F: Fn(RawWindow<'_>) + Send + 'static>(
&self,
pending: PendingWindow<T, Self>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self>>;
fn create_webview(
&self,
window_id: WindowId,
pending: PendingWebview<T, Self>,
) -> Result<DetachedWebview<T, Self>>;
fn primary_monitor(&self) -> Option<Monitor>;
fn monitor_from_point(&self, x: f64, y: f64) -> Option<Monitor>;
fn available_monitors(&self) -> Vec<Monitor>;
fn cursor_position(&self) -> Result<PhysicalPosition<f64>>;
fn set_theme(&self, theme: Option<Theme>);
fn set_device_event_filter(&mut self, filter: DeviceEventFilter);
fn run_iteration<F: FnMut(RunEvent<T>) + 'static>(&mut self, callback: F);
fn run<F: FnMut(RunEvent<T>) + 'static>(self, callback: F);
}
Expand description
The webview runtime interface.
Required Associated Types§
Sourcetype WindowDispatcher: WindowDispatch<T, Runtime = Self>
type WindowDispatcher: WindowDispatch<T, Runtime = Self>
The window message dispatcher.
Sourcetype WebviewDispatcher: WebviewDispatch<T, Runtime = Self>
type WebviewDispatcher: WebviewDispatch<T, Runtime = Self>
The webview message dispatcher.
Sourcetype Handle: RuntimeHandle<T, Runtime = Self>
type Handle: RuntimeHandle<T, Runtime = Self>
The runtime handle type.
Sourcetype EventLoopProxy: EventLoopProxy<T>
type EventLoopProxy: EventLoopProxy<T>
The proxy type.
Required Methods§
Sourcefn new(args: RuntimeInitArgs) -> Result<Self>
fn new(args: RuntimeInitArgs) -> Result<Self>
Creates a new webview runtime. Must be used on the main thread.
Sourcefn new_any_thread(args: RuntimeInitArgs) -> Result<Self>
Available on Windows or Linux only.
fn new_any_thread(args: RuntimeInitArgs) -> Result<Self>
Creates a new webview runtime on any thread.
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 create_window<F: Fn(RawWindow<'_>) + Send + 'static>(
&self,
pending: PendingWindow<T, Self>,
after_window_creation: Option<F>,
) -> Result<DetachedWindow<T, Self>>
fn create_window<F: Fn(RawWindow<'_>) + Send + 'static>( &self, pending: PendingWindow<T, Self>, after_window_creation: Option<F>, ) -> Result<DetachedWindow<T, Self>>
Create a new window.
Sourcefn create_webview(
&self,
window_id: WindowId,
pending: PendingWebview<T, Self>,
) -> Result<DetachedWebview<T, Self>>
fn create_webview( &self, window_id: WindowId, pending: PendingWebview<T, Self>, ) -> Result<DetachedWebview<T, Self>>
Create a new webview.
fn primary_monitor(&self) -> Option<Monitor>
fn monitor_from_point(&self, x: f64, y: f64) -> Option<Monitor>
fn available_monitors(&self) -> Vec<Monitor>
fn cursor_position(&self) -> Result<PhysicalPosition<f64>>
fn set_theme(&self, theme: Option<Theme>)
Sourcefn set_device_event_filter(&mut self, filter: DeviceEventFilter)
fn set_device_event_filter(&mut self, filter: DeviceEventFilter)
Change the device event filter mode.
Since the DeviceEvent capture can lead to high CPU usage for unfocused windows, tao
will ignore them by default for unfocused windows on Windows. This method allows changing
the filter to explicitly capture them again.
§Platform-specific
- ** Linux / macOS / iOS / Android**: Unsupported.
Sourcefn run_iteration<F: FnMut(RunEvent<T>) + 'static>(&mut self, callback: F)
fn run_iteration<F: FnMut(RunEvent<T>) + 'static>(&mut self, callback: F)
Runs an iteration of the runtime event loop and returns control flow to the caller.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.