pub struct Display { /* private fields */ }Expand description
One immutable display description in global logical desktop coordinates.
Implementations§
Source§impl Display
impl Display
Sourcepub fn new(
id: DisplayId,
name: impl Into<Arc<str>>,
bounds: Rect,
visible_bounds: Rect,
scale_factor: f32,
) -> Result<Self, DisplayError>
pub fn new( id: DisplayId, name: impl Into<Arc<str>>, bounds: Rect, visible_bounds: Rect, scale_factor: f32, ) -> Result<Self, DisplayError>
Build a validated display value, primarily for deterministic platform adapters and tests.
pub const fn id(&self) -> DisplayId
pub const fn uuid(&self) -> Option<DisplayUuid>
pub fn name(&self) -> &str
Sourcepub const fn bounds(&self) -> Rect
pub const fn bounds(&self) -> Rect
Complete display rectangle in global logical desktop coordinates.
Sourcepub const fn visible_bounds(&self) -> Rect
pub const fn visible_bounds(&self) -> Rect
Work area excluding persistent native chrome such as the Dock, menu bar, or taskbar.
pub const fn scale_factor(&self) -> f32
pub const fn refresh_rate_millihertz(&self) -> Option<u32>
pub const fn is_primary(&self) -> bool
Sourcepub const fn rotation_degrees(&self) -> u16
pub const fn rotation_degrees(&self) -> u16
Clockwise desktop rotation reported by the operating system: 0, 90, 180, or 270.
Platforms that do not report a rotation return 0.
Sourcepub const fn is_internal(&self) -> bool
pub const fn is_internal(&self) -> bool
Whether the operating system reports this display as the machine’s built-in panel.
Sourcepub const fn color_depth(&self) -> Option<u8>
pub const fn color_depth(&self) -> Option<u8>
Bits per pixel reported by the operating system, when it exposes one.
pub fn with_uuid(self, uuid: DisplayUuid) -> Self
pub fn with_refresh_rate_millihertz(self, refresh_rate: u32) -> Self
Sourcepub fn with_rotation_degrees(self, degrees: u16) -> Self
pub fn with_rotation_degrees(self, degrees: u16) -> Self
Record a clockwise rotation, normalized to the nearest quarter turn.
Sourcepub fn with_internal(self, is_internal: bool) -> Self
pub fn with_internal(self, is_internal: bool) -> Self
Record whether the display is the machine’s built-in panel.
Sourcepub fn with_color_depth(self, bits_per_pixel: u8) -> Self
pub fn with_color_depth(self, bits_per_pixel: u8) -> Self
Record a reported bit depth. Zero and values above MAX_DISPLAY_COLOR_DEPTH clear it.
Sourcepub fn centered_bounds(&self, size: Size) -> Rect
pub fn centered_bounds(&self, size: Size) -> Rect
Center and, if necessary, shrink a window rectangle into this display’s visible work area.
Sourcepub fn constrain_bounds(&self, bounds: Rect) -> Rect
pub fn constrain_bounds(&self, bounds: Rect) -> Rect
Keep a window rectangle fully inside this display’s visible work area.
Oversized or non-finite dimensions are replaced by the available dimension. This helper is intentionally pure and does not move a native window by itself.
Trait Implementations§
impl StructuralPartialEq for Display
Auto Trait Implementations§
impl Forget for Display
impl Freeze for Display
impl Move for Display
impl RefUnwindSafe for Display
impl Send for Display
impl Sync for Display
impl Unpin for Display
impl UnsafeUnpin for Display
impl UnwindSafe for Display
Blanket Implementations§
impl<T> Action for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.