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

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());
    }

Methods

impl Rgb565
[src]

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

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

Trait Implementations

impl From<Rgb565> for PixelColor
[src]

Performs the conversion.

impl Copy for Rgb565
[src]

impl Clone for Rgb565
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Rgb565
[src]

Formats the value using the given formatter. Read more

impl Default for Rgb565
[src]

Returns the "default value" for a type. Read more

impl PartialEq for Rgb565
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Into<u16> for Rgb565
[src]

Performs the conversion.

impl From<u16> for Rgb565
[src]

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

impl From<PixelColor> for Rgb565
[src]

Performs the conversion.

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

Performs the conversion.

Auto Trait Implementations

impl Send for Rgb565

impl Sync for Rgb565