MonitorHandleProvider

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

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

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_output device.
  • X11: This is the ID of the CRTC.
  • Web: This is an internal ID not meant for consumption.

fn name(&self) -> Option<Cow<'_, str>>

Returns a human-readable name of the monitor.

Returns None if the monitor doesn’t exist anymore or the name couldn’t be obtained.

§Platform-specific

Web: Always returns None without detailed monitor permissions.

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

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.0 without detailed_monitor_permissions.

fn current_video_mode(&self) -> Option<VideoMode>

fn video_modes(&self) -> Box<dyn Iterator<Item = VideoMode>>

Returns all fullscreen video modes supported by this monitor.

Implementations§

§

impl dyn MonitorHandleProvider + '_

pub fn cast_ref<T>(&self) -> Option<&T>

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>

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 + '_>>

Owned downcast to the backend concrete type.

Returns Err with self if the object was not from that backend.

Trait Implementations§

§

impl PartialEq for dyn MonitorHandleProvider + '_

§

fn eq(&self, other: &dyn MonitorHandleProvider) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Eq for dyn MonitorHandleProvider + '_

Implementors§