Enum style::color::component::ColorComponent
source · #[repr(u8)]pub enum ColorComponent<ValueType> {
None,
Value(ValueType),
Calc(Box<GenericCalcNode<Leaf>>),
AlphaOmitted,
}
Expand description
A single color component.
Variants§
None
The “none” keyword.
Value(ValueType)
A absolute value.
Calc(Box<GenericCalcNode<Leaf>>)
A calc() value.
AlphaOmitted
Used when alpha components are not specified.
Implementations§
source§impl<ValueType> ColorComponent<ValueType>
impl<ValueType> ColorComponent<ValueType>
source§impl<ValueType: ColorComponentType> ColorComponent<ValueType>
impl<ValueType: ColorComponentType> ColorComponent<ValueType>
sourcepub fn parse<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
allow_none: bool,
) -> Result<Self, ParseError<'i>>
pub fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, allow_none: bool, ) -> Result<Self, ParseError<'i>>
Parse a single ColorComponent.
sourcepub fn resolve(
&self,
origin_color: Option<&AbsoluteColor>,
) -> Result<Option<ValueType>, ()>
pub fn resolve( &self, origin_color: Option<&AbsoluteColor>, ) -> Result<Option<ValueType>, ()>
Resolve a ColorComponent into a float. None is “none”.
source§impl ColorComponent<NumberOrPercentageComponent>
impl ColorComponent<NumberOrPercentageComponent>
sourcefn could_be_number(&self) -> bool
fn could_be_number(&self) -> bool
Return true if the value contained inside is/can resolve to a percentage. Also returns false if the node is invalid somehow.
sourcefn could_be_percentage(&self) -> bool
fn could_be_percentage(&self) -> bool
Return true if the value contained inside is/can resolve to a percentage. Also returns false if the node is invalid somehow.
Trait Implementations§
source§impl<ValueType: Clone> Clone for ColorComponent<ValueType>
impl<ValueType: Clone> Clone for ColorComponent<ValueType>
source§fn clone(&self) -> ColorComponent<ValueType>
fn clone(&self) -> ColorComponent<ValueType>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<ValueType: Debug> Debug for ColorComponent<ValueType>
impl<ValueType: Debug> Debug for ColorComponent<ValueType>
source§impl From<ColorComponent<f32>> for ComponentDetails
impl From<ColorComponent<f32>> for ComponentDetails
source§fn from(value: ColorComponent<f32>) -> Self
fn from(value: ColorComponent<f32>) -> Self
Converts to this type from the input type.
source§impl<ValueType> MallocSizeOf for ColorComponent<ValueType>where
ValueType: MallocSizeOf,
impl<ValueType> MallocSizeOf for ColorComponent<ValueType>where
ValueType: MallocSizeOf,
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl<ValueType: PartialEq> PartialEq for ColorComponent<ValueType>
impl<ValueType: PartialEq> PartialEq for ColorComponent<ValueType>
source§fn eq(&self, other: &ColorComponent<ValueType>) -> bool
fn eq(&self, other: &ColorComponent<ValueType>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<ValueType> ToAnimatedValue for ColorComponent<ValueType>
impl<ValueType> ToAnimatedValue for ColorComponent<ValueType>
§type AnimatedValue = ColorComponent<ValueType>
type AnimatedValue = ColorComponent<ValueType>
The type of the animated value.
source§fn to_animated_value(self, _context: &Context<'_>) -> Self::AnimatedValue
fn to_animated_value(self, _context: &Context<'_>) -> Self::AnimatedValue
Converts this value to an animated value.
source§fn from_animated_value(animated: Self::AnimatedValue) -> Self
fn from_animated_value(animated: Self::AnimatedValue) -> Self
Converts back an animated value into a computed value.
source§impl<ValueType: ToCss> ToCss for ColorComponent<ValueType>
impl<ValueType: ToCss> ToCss for ColorComponent<ValueType>
source§impl<ValueType> ToShmem for ColorComponent<ValueType>where
ValueType: ToShmem,
impl<ValueType> ToShmem for ColorComponent<ValueType>where
ValueType: ToShmem,
impl<ValueType> StructuralPartialEq for ColorComponent<ValueType>
Auto Trait Implementations§
impl<ValueType> Freeze for ColorComponent<ValueType>where
ValueType: Freeze,
impl<ValueType> RefUnwindSafe for ColorComponent<ValueType>where
ValueType: RefUnwindSafe,
impl<ValueType> Send for ColorComponent<ValueType>where
ValueType: Send,
impl<ValueType> Sync for ColorComponent<ValueType>where
ValueType: Sync,
impl<ValueType> Unpin for ColorComponent<ValueType>where
ValueType: Unpin,
impl<ValueType> UnwindSafe for ColorComponent<ValueType>where
ValueType: 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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert