#[repr(C)]pub struct GenericColorMix<Color, Percentage> {
pub interpolation: ColorInterpolationMethod,
pub left: Color,
pub left_percentage: Percentage,
pub right: Color,
pub right_percentage: Percentage,
pub flags: ColorMixFlags,
}
Expand description
A restricted version of the css color-mix()
function, which only supports
percentages.
https://drafts.csswg.org/css-color-5/#color-mix
Fields§
§interpolation: ColorInterpolationMethod
§left: Color
§left_percentage: Percentage
§right: Color
§right_percentage: Percentage
§flags: ColorMixFlags
Implementations§
source§impl<Percentage> ColorMix<GenericColor<Percentage>, Percentage>
impl<Percentage> ColorMix<GenericColor<Percentage>, Percentage>
sourcepub fn mix_to_absolute(&self) -> Option<AbsoluteColor>where
Percentage: ToPercentage,
pub fn mix_to_absolute(&self) -> Option<AbsoluteColor>where
Percentage: ToPercentage,
Mix the colors so that we get a single color. If any of the 2 colors are not mixable (perhaps not absolute?), then return None.
source§impl GenericColorMix<Color, Percentage>
impl GenericColorMix<Color, Percentage>
fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, preserve_authored: PreserveAuthored, ) -> Result<Self, ParseError<'i>>
Trait Implementations§
source§impl<Color: Clone, Percentage: Clone> Clone for GenericColorMix<Color, Percentage>
impl<Color: Clone, Percentage: Clone> Clone for GenericColorMix<Color, Percentage>
source§fn clone(&self) -> GenericColorMix<Color, Percentage>
fn clone(&self) -> GenericColorMix<Color, Percentage>
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<Color, Percentage> MallocSizeOf for GenericColorMix<Color, Percentage>where
Color: MallocSizeOf,
Percentage: MallocSizeOf,
impl<Color, Percentage> MallocSizeOf for GenericColorMix<Color, Percentage>where
Color: MallocSizeOf,
Percentage: 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<Color: PartialEq, Percentage: PartialEq> PartialEq for GenericColorMix<Color, Percentage>
impl<Color: PartialEq, Percentage: PartialEq> PartialEq for GenericColorMix<Color, Percentage>
source§fn eq(&self, other: &GenericColorMix<Color, Percentage>) -> bool
fn eq(&self, other: &GenericColorMix<Color, Percentage>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.source§impl<Color, Percentage> ToAnimatedValue for GenericColorMix<Color, Percentage>where
Color: ToAnimatedValue,
Percentage: ToAnimatedValue,
impl<Color, Percentage> ToAnimatedValue for GenericColorMix<Color, Percentage>where
Color: ToAnimatedValue,
Percentage: ToAnimatedValue,
source§type AnimatedValue = GenericColorMix<<Color as ToAnimatedValue>::AnimatedValue, <Percentage as ToAnimatedValue>::AnimatedValue>
type AnimatedValue = GenericColorMix<<Color as ToAnimatedValue>::AnimatedValue, <Percentage as ToAnimatedValue>::AnimatedValue>
The type of the animated value.
source§fn from_animated_value(from: Self::AnimatedValue) -> Self
fn from_animated_value(from: Self::AnimatedValue) -> Self
Converts back an animated value into a computed 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§impl<Color, Percentage> ToComputedValue for GenericColorMix<Color, Percentage>where
Color: ToComputedValue,
Percentage: ToComputedValue,
impl<Color, Percentage> ToComputedValue for GenericColorMix<Color, Percentage>where
Color: ToComputedValue,
Percentage: ToComputedValue,
source§type ComputedValue = GenericColorMix<<Color as ToComputedValue>::ComputedValue, <Percentage as ToComputedValue>::ComputedValue>
type ComputedValue = GenericColorMix<<Color as ToComputedValue>::ComputedValue, <Percentage as ToComputedValue>::ComputedValue>
The computed value type we’re going to be converted to.
source§fn from_computed_value(from: &Self::ComputedValue) -> Self
fn from_computed_value(from: &Self::ComputedValue) -> Self
Convert a computed value to specified value form. Read more
source§fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
Convert a specified value to a computed value, using itself and the data
inside the
Context
.source§impl<Color, Percentage> ToResolvedValue for GenericColorMix<Color, Percentage>where
Color: ToResolvedValue,
Percentage: ToResolvedValue,
impl<Color, Percentage> ToResolvedValue for GenericColorMix<Color, Percentage>where
Color: ToResolvedValue,
Percentage: ToResolvedValue,
source§type ResolvedValue = GenericColorMix<<Color as ToResolvedValue>::ResolvedValue, <Percentage as ToResolvedValue>::ResolvedValue>
type ResolvedValue = GenericColorMix<<Color as ToResolvedValue>::ResolvedValue, <Percentage as ToResolvedValue>::ResolvedValue>
The resolved value type we’re going to be converted to.
source§fn from_resolved_value(from: Self::ResolvedValue) -> Self
fn from_resolved_value(from: Self::ResolvedValue) -> Self
Convert a resolved value to resolved value form.
source§fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
Convert a resolved value to a resolved value.
source§impl<Color, Percentage> ToShmem for GenericColorMix<Color, Percentage>
impl<Color, Percentage> ToShmem for GenericColorMix<Color, Percentage>
impl<Color, Percentage> StructuralPartialEq for GenericColorMix<Color, Percentage>
Auto Trait Implementations§
impl<Color, Percentage> Freeze for GenericColorMix<Color, Percentage>
impl<Color, Percentage> RefUnwindSafe for GenericColorMix<Color, Percentage>where
Color: RefUnwindSafe,
Percentage: RefUnwindSafe,
impl<Color, Percentage> Send for GenericColorMix<Color, Percentage>
impl<Color, Percentage> Sync for GenericColorMix<Color, Percentage>
impl<Color, Percentage> Unpin for GenericColorMix<Color, Percentage>
impl<Color, Percentage> UnwindSafe for GenericColorMix<Color, Percentage>where
Color: UnwindSafe,
Percentage: 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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