[−][src]Struct sensehat_screen::color::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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<'a> From<&'a PixelColor> for Rgb565
[src]
fn from(color: &'a PixelColor) -> Self
[src]
impl From<[u8; 2]> for Rgb565
[src]
impl From<(u8, u8, u8)> for Rgb565
[src]
impl From<PixelColor> for Rgb565
[src]
fn from(color: PixelColor) -> Self
[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]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for Rgb565
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rgb565
impl Send for Rgb565
impl Sync for Rgb565
impl Unpin for Rgb565
impl UnwindSafe for Rgb565
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,