[]Struct smart_leds::RGB

#[repr(C)]
pub struct RGB<ComponentType> {
    pub r: ComponentType,
    pub g: ComponentType,
    pub b: ComponentType,
}

The RGB pixel

The component type can be u8 (aliased as RGB8), u16 (aliased as RGB16), or any other type (but simple copyable types are recommended.)

Fields

r: ComponentType

Red

g: ComponentType

Green

b: ComponentType

Blue

Methods

impl<T> RGB<T>

pub const fn new(r: T, g: T, b: T) -> RGB<T>

Convenience function for creating a new pixel

impl<T> RGB<T> where
    T: Clone

pub fn iter(&self) -> Cloned<Iter<T>>

Iterate over color components (R, G, and B)

pub fn alpha(&self, a: T) -> RGBA<T, T>

pub fn new_alpha<A>(&self, a: A) -> RGBA<T, A>

Trait Implementations

impl<T, B> ComponentMap<RGB<B>, T, B> for RGB<T> where
    T: Copy

impl<ComponentType> PartialEq<RGB<ComponentType>> for RGB<ComponentType> where
    ComponentType: PartialEq<ComponentType>, 

impl<ComponentType> Debug for RGB<ComponentType> where
    ComponentType: Debug

impl<T> AsMut<[T]> for RGB<T>

impl From<RGB<i16>> for RGB<f64>

impl From<RGB<f32>> for RGB<f64>

impl From<RGB<u16>> for RGB<f64>

impl From<RGB<u16>> for RGB<i32>

impl<T> From<[T; 3]> for RGB<T> where
    T: Copy

impl From<RGB<u8>> for RGB<f64>

impl From<RGB<u16>> for RGB<f32>

impl<T> From<BGR<T>> for RGB<T>

impl From<RGB<i16>> for RGB<f32>

impl<T> From<RGB<T>> for RGBA<T, u8> where
    T: Copy

Assumes 255 is opaque

impl From<RGB<u8>> for RGB<f32>

impl From<RGB<u8>> for RGB<i16>

impl From<RGB<i32>> for RGB<f64>

impl<T> From<Gray<T>> for RGB<T> where
    T: Clone

impl<T> From<RGB<T>> for RGBA<T, u16> where
    T: Copy

Assumes 65535 is opaque

impl<T> From<(T, T, T)> for RGB<T>

impl<T> Add<RGB<T>> for RGB<T> where
    T: Add<T>, 

px + px

type Output = RGB<<T as Add<T>>::Output>

The resulting type after applying the + operator.

impl<T> Add<T> for RGB<T> where
    T: Copy + Add<T, Output = T> + Clone + Add<T>, 

px + 1

type Output = RGB<T>

The resulting type after applying the + operator.

impl<ComponentType> Clone for RGB<ComponentType> where
    ComponentType: Clone

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<ComponentType> PartialOrd<RGB<ComponentType>> for RGB<ComponentType> where
    ComponentType: PartialOrd<ComponentType>, 

impl<ComponentType> Eq for RGB<ComponentType> where
    ComponentType: Eq

impl<T> Display for RGB<T> where
    T: Display

impl<T> Into<(T, T, T)> for RGB<T>

impl<T> Into<[T; 3]> for RGB<T>

impl<T> Sub<RGB<T>> for RGB<T> where
    T: Sub<T>, 

px - px

type Output = RGB<<T as Sub<T>>::Output>

The resulting type after applying the - operator.

impl<T> AsRef<[T]> for RGB<T>

impl<ComponentType> Hash for RGB<ComponentType> where
    ComponentType: Hash

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T> ComponentSlice<T> for RGB<T>

impl<ComponentType> Ord for RGB<ComponentType> where
    ComponentType: Ord

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<T> FromIterator<T> for RGB<T>

fn from_iter<I>(into_iter: I) -> RGB<T> where
    I: IntoIterator<Item = T>, 

Takes exactly 3 elements from the iterator and creates a new instance. Panics if there are fewer elements in the iterator.

impl<T> Mul<T> for RGB<T> where
    T: Copy + Mul<T, Output = T> + Clone + Mul<T>, 

px * 1

type Output = RGB<T>

The resulting type after applying the * operator.

impl<ComponentType> Copy for RGB<ComponentType> where
    ComponentType: Copy

impl<ComponentType> Default for RGB<ComponentType> where
    ComponentType: Default

Auto Trait Implementations

impl<ComponentType> Unpin for RGB<ComponentType> where
    ComponentType: Unpin

impl<ComponentType> Send for RGB<ComponentType> where
    ComponentType: Send

impl<ComponentType> Sync for RGB<ComponentType> where
    ComponentType: Sync

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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.

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

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

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