Trait MonitorHandleProvider
pub trait MonitorHandleProvider:
AsAny
+ Debug
+ Send
+ Sync {
// Required methods
fn id(&self) -> u128;
fn native_id(&self) -> u64;
fn name(&self) -> Option<Cow<'_, str>>;
fn position(&self) -> Option<PhysicalPosition<i32>>;
fn scale_factor(&self) -> f64;
fn current_video_mode(&self) -> Option<VideoMode>;
fn video_modes(&self) -> Box<dyn Iterator<Item = VideoMode>>;
}Expand description
Provider of the MonitorHandle.
Required Methods§
fn id(&self) -> u128
fn id(&self) -> u128
Identifier for this monitor.
The representation of this modifier is not guaranteed and should be used only to compare monitors.
fn native_id(&self) -> u64
fn native_id(&self) -> u64
Native platform identifier of this monitor.
§Platform-specific
- Windows: This is
HMONITOR. - macOS: This is
CGDirectDisplayID. - iOS: This is
UIScreen*. - Wayland: This is the ID of the
wl_outputdevice. - X11: This is the ID of the CRTC.
- Web: This is an internal ID not meant for consumption.
fn position(&self) -> Option<PhysicalPosition<i32>>
fn position(&self) -> Option<PhysicalPosition<i32>>
Returns the top-left corner position of the monitor in desktop coordinates.
This position is in the same coordinate system as Window::outer_position.
§Platform-specific
Web: Always returns None without detailed monitor permissions.
fn scale_factor(&self) -> f64
fn scale_factor(&self) -> f64
Returns the scale factor of the underlying monitor. To map logical pixels to physical
pixels and vice versa, use Window::scale_factor.
See the dpi module for more information.
- Wayland: May differ from
Window::scale_factor. - Web: Always returns
0.0withoutdetailed_monitor_permissions.
fn current_video_mode(&self) -> Option<VideoMode>
fn video_modes(&self) -> Box<dyn Iterator<Item = VideoMode>>
fn video_modes(&self) -> Box<dyn Iterator<Item = VideoMode>>
Returns all fullscreen video modes supported by this monitor.
Implementations§
§impl dyn MonitorHandleProvider + '_
impl dyn MonitorHandleProvider + '_
pub fn cast_ref<T>(&self) -> Option<&T>where
T: MonitorHandleProvider,
pub fn cast_ref<T>(&self) -> Option<&T>where
T: MonitorHandleProvider,
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: MonitorHandleProvider,
pub fn cast_mut<T>(&mut self) -> Option<&mut T>where
T: MonitorHandleProvider,
Mutable downcast to the backend concrete type.
Returns None if the object was not from that backend.
pub fn cast<T>(
self: Box<dyn MonitorHandleProvider + '_>,
) -> Result<Box<T>, Box<dyn MonitorHandleProvider + '_>>where
T: MonitorHandleProvider,
pub fn cast<T>(
self: Box<dyn MonitorHandleProvider + '_>,
) -> Result<Box<T>, Box<dyn MonitorHandleProvider + '_>>where
T: MonitorHandleProvider,
Owned downcast to the backend concrete type.
Returns Err with self if the object was not from that backend.