Struct style::properties_and_values::value::Value
source · pub struct Value<Component> {
pub(crate) v: ValueInner<Component>,
url_data: UrlExtraData,
}
Expand description
A struct for a single specified registered custom property value that includes its original URL
Fields§
§v: ValueInner<Component>
The registered custom property value.
url_data: UrlExtraData
The URL data of the registered custom property from before it was computed. This is necessary to uncompute registered custom properties.
Implementations§
source§impl<Component> Value<Component>
impl<Component> Value<Component>
sourcepub fn new(v: ValueInner<Component>, url_data: UrlExtraData) -> Self
pub fn new(v: ValueInner<Component>, url_data: UrlExtraData) -> Self
Creates a new registered custom property value.
sourcepub fn universal(var: Arc<ComputedPropertyValue>) -> Self
pub fn universal(var: Arc<ComputedPropertyValue>) -> Self
Creates a new registered custom property value presumed to have universal syntax.
source§impl Value<GenericValueComponent<Length, Number, Percentage, LengthPercentage, Color, GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, CssUrl, Integer, Angle, Time, Resolution, GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>>>
impl Value<GenericValueComponent<Length, Number, Percentage, LengthPercentage, Color, GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, CssUrl, Integer, Angle, Time, Resolution, GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>>>
sourcepub fn compute<'i, 't>(
input: &mut CSSParser<'i, 't>,
registration: &PropertyRegistrationData,
url_data: &UrlExtraData,
context: &Context<'_>,
allow_computationally_dependent: AllowComputationallyDependent,
) -> Result<ComputedValue, ()>
pub fn compute<'i, 't>( input: &mut CSSParser<'i, 't>, registration: &PropertyRegistrationData, url_data: &UrlExtraData, context: &Context<'_>, allow_computationally_dependent: AllowComputationallyDependent, ) -> Result<ComputedValue, ()>
Convert a registered custom property to a Computed custom property value, given input and a property registration.
sourcepub fn parse<'i, 't>(
input: &mut CSSParser<'i, 't>,
syntax: &Descriptor,
url_data: &UrlExtraData,
allow_computationally_dependent: AllowComputationallyDependent,
) -> Result<Self, StyleParseError<'i>>
pub fn parse<'i, 't>( input: &mut CSSParser<'i, 't>, syntax: &Descriptor, url_data: &UrlExtraData, allow_computationally_dependent: AllowComputationallyDependent, ) -> Result<Self, StyleParseError<'i>>
Parse and validate a registered custom property value according to its syntax descriptor, and check for computational independence.
source§impl Value<GenericValueComponent<CSSPixelLength, f32, Percentage, LengthPercentage, GenericColor<Percentage>, GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<CSSPixelLength>, NonNegative<LengthPercentage>, GenericPosition<LengthPercentage, LengthPercentage>, Angle, AngleOrPercentage, GenericColor<Percentage>>, ComputedUrl, GenericColor<Percentage>, Percentage, Resolution>, ComputedUrl, i32, Angle, Time, Resolution, GenericTransform<GenericTransformOperation<Angle, f32, CSSPixelLength, i32, LengthPercentage>>>>
impl Value<GenericValueComponent<CSSPixelLength, f32, Percentage, LengthPercentage, GenericColor<Percentage>, GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<CSSPixelLength>, NonNegative<LengthPercentage>, GenericPosition<LengthPercentage, LengthPercentage>, Angle, AngleOrPercentage, GenericColor<Percentage>>, ComputedUrl, GenericColor<Percentage>, Percentage, Resolution>, ComputedUrl, i32, Angle, Time, Resolution, GenericTransform<GenericTransformOperation<Angle, f32, CSSPixelLength, i32, LengthPercentage>>>>
fn serialization_types( &self, ) -> (TokenSerializationType, TokenSerializationType)
fn to_declared_value(&self) -> CustomDeclarationValue
sourcepub fn as_universal(&self) -> Option<&Arc<ComputedPropertyValue>>
pub fn as_universal(&self) -> Option<&Arc<ComputedPropertyValue>>
Returns the contained variable value if it exists, otherwise None
.
sourcepub fn is_parsed(&self, registration: &PropertyRegistrationData) -> bool
pub fn is_parsed(&self, registration: &PropertyRegistrationData) -> bool
Returns whether the the property is computed.
sourcepub fn to_variable_value(&self) -> ComputedPropertyValue
pub fn to_variable_value(&self) -> ComputedPropertyValue
Convert to an untyped variable value.
Trait Implementations§
source§impl<Component> MallocSizeOf for Value<Component>where
Component: MallocSizeOf,
impl<Component> MallocSizeOf for Value<Component>where
Component: MallocSizeOf,
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl<Component> ToComputedValue for Value<Component>where
Component: ToComputedValue,
impl<Component> ToComputedValue for Value<Component>where
Component: ToComputedValue,
source§type ComputedValue = Value<<Component as ToComputedValue>::ComputedValue>
type ComputedValue = Value<<Component as ToComputedValue>::ComputedValue>
source§fn from_computed_value(from: &Self::ComputedValue) -> Self
fn from_computed_value(from: &Self::ComputedValue) -> Self
source§fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
Context
.source§impl<Component> ToResolvedValue for Value<Component>where
Component: ToResolvedValue,
impl<Component> ToResolvedValue for Value<Component>where
Component: ToResolvedValue,
source§type ResolvedValue = Value<<Component as ToResolvedValue>::ResolvedValue>
type ResolvedValue = Value<<Component as ToResolvedValue>::ResolvedValue>
source§fn from_resolved_value(from: Self::ResolvedValue) -> Self
fn from_resolved_value(from: Self::ResolvedValue) -> Self
source§fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
impl<Component> StructuralPartialEq for Value<Component>
Auto Trait Implementations§
impl<Component> Freeze for Value<Component>where
Component: Freeze,
impl<Component> RefUnwindSafe for Value<Component>where
Component: RefUnwindSafe,
impl<Component> Send for Value<Component>where
Component: Send,
impl<Component> Sync for Value<Component>where
Component: Sync,
impl<Component> Unpin for Value<Component>where
Component: Unpin,
impl<Component> UnwindSafe for Value<Component>where
Component: UnwindSafe + RefUnwindSafe,
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
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)
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>
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>
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 more