mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 02:00:12 +01:00
add derives, u8::from(&Brightness)
This commit is contained in:
parent
4f1ef8aafb
commit
eb42e0aba1
|
@ -5,7 +5,7 @@ use bitvec::slice::IterMut;
|
|||
use crate::{BitVec, DataRef, Grid, PIXEL_HEIGHT, PIXEL_WIDTH};
|
||||
|
||||
/// A grid of pixels stored in packed bytes.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Bitmap {
|
||||
width: usize,
|
||||
height: usize,
|
||||
|
|
|
@ -19,7 +19,7 @@ use rand::{
|
|||
/// # let connection = Connection::open("127.0.0.1:2342").unwrap();
|
||||
/// let result = connection.send(Command::Brightness(b));
|
||||
/// ```
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub struct Brightness(u8);
|
||||
|
||||
/// A grid containing brightness values.
|
||||
|
@ -50,6 +50,12 @@ impl From<Brightness> for u8 {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<&Brightness> for u8 {
|
||||
fn from(brightness: &Brightness) -> Self {
|
||||
brightness.0
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<u8> for Brightness {
|
||||
type Error = u8;
|
||||
|
||||
|
|
Loading…
Reference in a new issue