pub struct RGB<T>where
T: Channel,{
pub red: T,
pub green: T,
pub blue: T,
}Expand description
Represents a color as red, green and blue channels with no transparency
Fields§
§red: T§green: T§blue: TImplementations§
Source§impl<T> RGB<T>where
T: Channel,
impl<T> RGB<T>where
T: Channel,
Sourcepub fn try_new(red: T, green: T, blue: T) -> Result<Self, ColorError>
pub fn try_new(red: T, green: T, blue: T) -> Result<Self, ColorError>
Creates a new instance
§Errors
Returns ColorError::OutsideBoundsNegative if any channel is less than ColorChannel::MIN
Returns ColorError::OutsideBoundsHigh if any channel is greater than ColorChannel::MAX
Trait Implementations§
Source§impl<T> From<PrimaryColor> for RGB<T>where
T: Channel,
impl<T> From<PrimaryColor> for RGB<T>where
T: Channel,
Source§fn from(color: PrimaryColor) -> Self
fn from(color: PrimaryColor) -> Self
Converts to this type from the input type.
impl<T> Copy for RGB<T>where
T: Channel + Copy,
impl<T> Eq for RGB<T>where
T: Channel + Eq,
impl<T> StructuralPartialEq for RGB<T>where
T: Channel,
Auto Trait Implementations§
impl<T> Freeze for RGB<T>where
T: Freeze,
impl<T> RefUnwindSafe for RGB<T>where
T: RefUnwindSafe,
impl<T> Send for RGB<T>where
T: Send,
impl<T> Sync for RGB<T>where
T: Sync,
impl<T> Unpin for RGB<T>where
T: Unpin,
impl<T> UnwindSafe for RGB<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more