#[non_exhaustive]pub enum ScreenSize {
Physical {
width_cm: u8,
height_cm: u8,
},
Landscape(u8),
Portrait(u8),
}Expand description
Physical screen dimensions or aspect ratio, decoded from EDID base block bytes 0x15–0x16.
The two bytes encode one of three things depending on which are zero:
0x15 | 0x16 | Meaning |
|---|---|---|
| non-0 | non-0 | Physical width × height in cm |
| non-0 | 0 | Landscape aspect ratio |
| 0 | non-0 | Portrait aspect ratio |
| 0 | 0 | Undefined — None on the field |
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Physical
Physical screen dimensions. Values are in centimetres (1–255 cm per axis).
Fields
Landscape(u8)
Landscape aspect ratio (width ÷ height > 1), encoded as a raw EDID byte.
Call landscape_ratio for the computed f32 value.
Portrait(u8)
Portrait aspect ratio (width ÷ height < 1), encoded as a raw EDID byte.
Call portrait_ratio for the computed f32 value.
Implementations§
Source§impl ScreenSize
impl ScreenSize
Sourcepub fn landscape_ratio(&self) -> Option<f32>
pub fn landscape_ratio(&self) -> Option<f32>
Returns the landscape aspect ratio (width ÷ height) for a Landscape variant.
Formula: (raw + 99) / 100. Range: 1.00 → 3.54.
Returns None for other variants.
Sourcepub fn portrait_ratio(&self) -> Option<f32>
pub fn portrait_ratio(&self) -> Option<f32>
Returns the portrait aspect ratio (width ÷ height) for a Portrait variant.
Formula: 100 / (raw + 99). Range: 0.28 → 0.99.
Returns None for other variants.
Trait Implementations§
Source§impl Clone for ScreenSize
impl Clone for ScreenSize
Source§fn clone(&self) -> ScreenSize
fn clone(&self) -> ScreenSize
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more