Trait ActiveEventLoop
pub trait ActiveEventLoop: AsAny + Debug {
Show 13 methods
// Required methods
fn create_proxy(&self) -> EventLoopProxy;
fn create_window(
&self,
window_attributes: WindowAttributes,
) -> Result<Box<dyn Window>, RequestError>;
fn create_custom_cursor(
&self,
custom_cursor: CustomCursorSource,
) -> Result<CustomCursor, RequestError>;
fn available_monitors(&self) -> Box<dyn Iterator<Item = MonitorHandle>>;
fn primary_monitor(&self) -> Option<MonitorHandle>;
fn listen_device_events(&self, allowed: DeviceEvents);
fn system_theme(&self) -> Option<Theme>;
fn set_control_flow(&self, control_flow: ControlFlow);
fn control_flow(&self) -> ControlFlow;
fn exit(&self);
fn exiting(&self) -> bool;
fn owned_display_handle(&self) -> OwnedDisplayHandle;
fn rwh_06_handle(&self) -> &dyn HasDisplayHandle;
}Required Methods§
fn create_proxy(&self) -> EventLoopProxy
fn create_proxy(&self) -> EventLoopProxy
Creates an EventLoopProxy that can be used to dispatch user events
to the main event loop, possibly from another thread.
fn create_window(
&self,
window_attributes: WindowAttributes,
) -> Result<Box<dyn Window>, RequestError>
fn create_window( &self, window_attributes: WindowAttributes, ) -> Result<Box<dyn Window>, RequestError>
Create the window.
Possible causes of error include denied permission, incompatible system, and lack of memory.
§Platform-specific
- Web: The window is created but not inserted into the Web page automatically. Please see the Web platform module for more information.
fn create_custom_cursor(
&self,
custom_cursor: CustomCursorSource,
) -> Result<CustomCursor, RequestError>
fn create_custom_cursor( &self, custom_cursor: CustomCursorSource, ) -> Result<CustomCursor, RequestError>
fn available_monitors(&self) -> Box<dyn Iterator<Item = MonitorHandle>>
fn available_monitors(&self) -> Box<dyn Iterator<Item = MonitorHandle>>
Returns the list of all the monitors available on the system.
§Platform-specific
Web: Only returns the current monitor without detailed monitor permissions.
fn primary_monitor(&self) -> Option<MonitorHandle>
fn primary_monitor(&self) -> Option<MonitorHandle>
Returns the primary monitor of the system.
Returns None if it can’t identify any monitor as a primary one.
§Platform-specific
- Wayland: Always returns
None. - Web: Always returns
Nonewithoutdetailed monitor permissions.
fn listen_device_events(&self, allowed: DeviceEvents)
fn listen_device_events(&self, allowed: DeviceEvents)
Change if or when DeviceEvents are captured.
Since the DeviceEvent capture can lead to high CPU usage for unfocused windows, winit
will ignore them by default for unfocused windows on Linux/BSD. This method allows changing
this at runtime to explicitly capture them again.
§Platform-specific
- Wayland / macOS / iOS / Android / Orbital: Unsupported.
fn system_theme(&self) -> Option<Theme>
fn system_theme(&self) -> Option<Theme>
Returns the current system theme.
Returns None if it cannot be determined on the current platform.
§Platform-specific
- iOS / Android / Wayland / x11 / Orbital: Unsupported.
fn set_control_flow(&self, control_flow: ControlFlow)
fn set_control_flow(&self, control_flow: ControlFlow)
Sets the ControlFlow.
fn control_flow(&self) -> ControlFlow
fn control_flow(&self) -> ControlFlow
Gets the current ControlFlow.
fn exit(&self)
fn exit(&self)
Stop the event loop.
§Platform-specific
§iOS
It is not possible to programmatically exit/quit an application on iOS, so this function is a no-op there. See also this technical Q&A.
fn exiting(&self) -> bool
fn exiting(&self) -> bool
Returns whether the ActiveEventLoop is about to stop.
Set by exit().
fn owned_display_handle(&self) -> OwnedDisplayHandle
fn owned_display_handle(&self) -> OwnedDisplayHandle
Gets a persistent reference to the underlying platform display.
See the OwnedDisplayHandle type for more information.
fn rwh_06_handle(&self) -> &dyn HasDisplayHandle
fn rwh_06_handle(&self) -> &dyn HasDisplayHandle
Get the raw-window-handle handle.
Implementations§
§impl dyn ActiveEventLoop + '_
impl dyn ActiveEventLoop + '_
pub fn cast_ref<T>(&self) -> Option<&T>where
T: ActiveEventLoop,
pub fn cast_ref<T>(&self) -> Option<&T>where
T: ActiveEventLoop,
Downcast to the backend concrete type.
Returns None if the object was not from that backend.
pub fn cast_mut<T>(&mut self) -> Option<&mut T>where
T: ActiveEventLoop,
pub fn cast_mut<T>(&mut self) -> Option<&mut T>where
T: ActiveEventLoop,
Mutable downcast to the backend concrete type.
Returns None if the object was not from that backend.
pub fn cast<T>(
self: Box<dyn ActiveEventLoop + '_>,
) -> Result<Box<T>, Box<dyn ActiveEventLoop + '_>>where
T: ActiveEventLoop,
pub fn cast<T>(
self: Box<dyn ActiveEventLoop + '_>,
) -> Result<Box<T>, Box<dyn ActiveEventLoop + '_>>where
T: ActiveEventLoop,
Owned downcast to the backend concrete type.
Returns Err with self if the object was not from that backend.
Trait Implementations§
§impl ActiveEventLoopExtWayland for dyn ActiveEventLoop + '_
impl ActiveEventLoopExtWayland for dyn ActiveEventLoop + '_
§fn is_wayland(&self) -> bool
fn is_wayland(&self) -> bool
ActiveEventLoop] uses Wayland.