displays_types 0.1.0

Shared display-related data types used across the displays crate and platform backends
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Brightness percentage in the inclusive range `0..=100`.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Brightness(u8);

impl Brightness {
    pub const fn new(value: u8) -> Self {
        if value > 100 {
            panic!("Brightness needs to be between 0 and 100");
        }
        Self(value)
    }

    pub fn value(&self) -> u8 {
        self.0
    }
}