Skip to main content

DynRuntime

Struct DynRuntime 

Source
pub struct DynRuntime<T: UserEvent> { /* private fields */ }
Expand description

A type-erased Runtime.

The concrete runtime is selected through its RuntimeInitAttrs, see DynRuntimeInitAttrs::new.

Implementations§

Source§

impl<T: UserEvent> DynRuntime<T>

Source

pub fn from_runtime<R: Runtime<T>>(runtime: R) -> Self

Wraps an already initialized runtime.

Prefer Runtime::new with DynRuntimeInitAttrs to let the runtime be initialized with the application’s RuntimeInitArgs; this is only useful for runtimes created by other means.

Source

pub fn is<R: Runtime<T>>(&self) -> bool

Whether the wrapped runtime is of type R.

Source

pub fn downcast_ref<R: Runtime<T>>(&self) -> Option<&R>

Returns a reference to the wrapped runtime if it is of type R.

Source

pub fn downcast_mut<R: Runtime<T>>(&mut self) -> Option<&mut R>

Returns a mutable reference to the wrapped runtime if it is of type R.

Trait Implementations§

Source§

impl<T: Debug + UserEvent> Debug for DynRuntime<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: UserEvent> Runtime<T> for DynRuntime<T>

Source§

type WindowDispatcher = DynWindowDispatcher<T>

The window message dispatcher.
Source§

type WebviewDispatcher = DynWebviewDispatcher<T>

The webview message dispatcher.
Source§

type Handle = DynRuntimeHandle<T>

The runtime handle type.
Source§

type EventLoopProxy = DynEventLoopProxy<T>

The proxy type.
Source§

type RuntimeWebviewAttributes = DynWebviewAttributes

The runtime-specific webview attributes, set on the webview builders through the runtime’s extension traits. Read more
Source§

type Webview = DynWebview

The platform webview handle exposed through WebviewDispatch::with_webview. Read more
Source§

type RuntimeInitAttrs = DynRuntimeInitAttrs<T>

Runtime-specific initialization attributes. Also used to select this runtime, see RuntimeInitAttrs.
Source§

type WindowOpener = DynWindowOpener

Data about the window that requested the new window for PendingWebview::new_window_handler.
Source§

fn new(args: RuntimeInitArgs<Self::RuntimeInitAttrs>) -> Result<Self>

Creates a new webview runtime. Must be used on the main thread.
Source§

fn new_any_thread(args: RuntimeInitArgs<Self::RuntimeInitAttrs>) -> Result<Self>

Available on DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD or Windows only.
Creates a new webview runtime on any thread.
Source§

fn create_proxy(&self) -> Self::EventLoopProxy

Creates an EventLoopProxy that can be used to dispatch user events to the main event loop.
Source§

fn handle(&self) -> Self::Handle

Gets a runtime handle.
Source§

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.
Source§

fn create_webview( &self, window_id: WindowId, pending: PendingWebview<T, Self>, ) -> Result<DetachedWebview<T, Self>>

Create a new webview.
Source§

fn primary_monitor(&self) -> Option<Monitor>

Returns the primary monitor of the system. Read more
Source§

fn monitor_from_point(&self, x: f64, y: f64) -> Option<Monitor>

Returns the monitor that contains the given point.
Source§

fn available_monitors(&self) -> Vec<Monitor>

Returns the list of all the monitors available on the system.
Source§

fn cursor_position(&self) -> Result<PhysicalPosition<f64>>

Get the cursor position relative to the top-left hand corner of the desktop.
Source§

fn set_theme(&self, theme: Option<Theme>)

Sets the app theme.
Source§

fn set_device_event_filter(&mut self, filter: DeviceEventFilter)

Change the device event filter mode. Read more
Source§

fn run_iteration<F: FnMut(RunEvent<T>) + 'static>(&mut self, callback: F)

Available on desktop only.
Runs an iteration of the runtime event loop and returns control flow to the caller.
Source§

fn run_return<F: FnMut(RunEvent<T>) + 'static>(self, callback: F) -> i32

Equivalent to Runtime::run but returns the exit code instead of exiting the process.
Source§

fn run<F: FnMut(RunEvent<T>) + 'static>(self, callback: F)

Run the webview runtime.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for DynRuntime<T>

§

impl<T> !Send for DynRuntime<T>

§

impl<T> !Sync for DynRuntime<T>

§

impl<T> !UnwindSafe for DynRuntime<T>

§

impl<T> Freeze for DynRuntime<T>
where Box<dyn ErasedRuntime<T>>: Freeze,

§

impl<T> Unpin for DynRuntime<T>
where Box<dyn ErasedRuntime<T>>: Unpin,

§

impl<T> UnsafeUnpin for DynRuntime<T>
where Box<dyn ErasedRuntime<T>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.