[][src]Struct sensehat_screen::color::Rgb565

pub struct Rgb565(_);

RGB color stored as 16-bit digit, using RGB565 encoding/decoding.

    // convert directly from u16
    let red: Rgb565 = 0xF800.into();
    // convert from a 3-byte tuple
    let green: Rgb565 = (0, 0xFF, 0).into();
    assert_eq!(green, 0x07E0.into());
    // convert from a 2-byte array
    if cfg!(not(feature = "big-endian")) {
        let blue: Rgb565 = [0x1F, 0x00].into();
        assert_eq!(blue, 0x001F.into());
    }

    if cfg!(feature = "big-endian") {
        let blue: Rgb565 = [0x00, 0x1F].into();
        assert_eq!(blue, 0x001F.into());
    }

Implementations

impl Rgb565[src]

pub fn from_rgb(red: u8, green: u8, blue: u8) -> Self[src]

Create Rgb565 instance from red, green, and blue u8 values.

pub fn to_rgb(self) -> (u8, u8, u8)[src]

Create (u8, u8, u8) instance from a Rgb565 instance.

Trait Implementations

impl Clone for Rgb565[src]

impl Copy for Rgb565[src]

impl Debug for Rgb565[src]

impl Default for Rgb565[src]

impl<'de> Deserialize<'de> for Rgb565[src]

impl<'a> From<&'a PixelColor> for Rgb565[src]

impl From<[u8; 2]> for Rgb565[src]

impl From<(u8, u8, u8)> for Rgb565[src]

impl From<PixelColor> for Rgb565[src]

impl From<Rgb565> for PixelColor[src]

impl From<u16> for Rgb565[src]

impl Into<[u8; 2]> for Rgb565[src]

impl Into<(u8, u8, u8)> for Rgb565[src]

impl Into<u16> for Rgb565[src]

impl PartialEq<Rgb565> for Rgb565[src]

impl Serialize for Rgb565[src]

impl StructuralPartialEq for Rgb565[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.