pub type SpecifiedValue = VariableValue;
Expand description
Both specified and computed values are VariableValues, the difference is whether var() functions are expanded.
Aliased Type§
struct SpecifiedValue {
pub css: String,
pub url_data: UrlExtraData,
first_token_type: TokenSerializationType,
last_token_type: TokenSerializationType,
references: References,
}
Fields§
§css: String
The raw CSS string.
url_data: UrlExtraData
The url data of the stylesheet where this value came from.
first_token_type: TokenSerializationType
§last_token_type: TokenSerializationType
§references: References
var(), env(), or non-custom property (e.g. through em
) references.
Implementations
Source§impl VariableValue
impl VariableValue
fn empty(url_data: &UrlExtraData) -> Self
Sourcepub fn new(
css: String,
url_data: &UrlExtraData,
first_token_type: TokenSerializationType,
last_token_type: TokenSerializationType,
) -> Self
pub fn new( css: String, url_data: &UrlExtraData, first_token_type: TokenSerializationType, last_token_type: TokenSerializationType, ) -> Self
Create a new custom property without parsing if the CSS is known to be valid and contain no references.
fn push<'i>( &mut self, css: &str, css_first_token_type: TokenSerializationType, css_last_token_type: TokenSerializationType, ) -> Result<(), ()>
Sourcepub fn parse<'i, 't>(
input: &mut Parser<'i, 't>,
url_data: &UrlExtraData,
) -> Result<Self, ParseError<'i>>
pub fn parse<'i, 't>( input: &mut Parser<'i, 't>, url_data: &UrlExtraData, ) -> Result<Self, ParseError<'i>>
Parse a custom property value.
Sourcefn integer(number: i32, url_data: &UrlExtraData) -> Self
fn integer(number: i32, url_data: &UrlExtraData) -> Self
Create VariableValue from an int.
Sourcefn ident(ident: &'static str, url_data: &UrlExtraData) -> Self
fn ident(ident: &'static str, url_data: &UrlExtraData) -> Self
Create VariableValue from an int.
Sourcefn pixels(number: f32, url_data: &UrlExtraData) -> Self
fn pixels(number: f32, url_data: &UrlExtraData) -> Self
Create VariableValue from a float amount of CSS pixels.
Sourcefn int_ms(number: i32, url_data: &UrlExtraData) -> Self
fn int_ms(number: i32, url_data: &UrlExtraData) -> Self
Create VariableValue from an integer amount of milliseconds.
Sourcefn int_pixels(number: i32, url_data: &UrlExtraData) -> Self
fn int_pixels(number: i32, url_data: &UrlExtraData) -> Self
Create VariableValue from an integer amount of CSS pixels.
fn from_token(token: Token<'_>, url_data: &UrlExtraData) -> Self
Sourcepub fn has_references(&self) -> bool
pub fn has_references(&self) -> bool
Returns whether this variable value has any reference to the environment or other variables.
Trait Implementations§
Source§impl ToCss for SpecifiedValue
impl ToCss for SpecifiedValue
Source§impl Clone for VariableValue
impl Clone for VariableValue
Source§fn clone(&self) -> VariableValue
fn clone(&self) -> VariableValue
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 Debug for VariableValue
impl Debug for VariableValue
Source§impl MallocSizeOf for VariableValue
impl MallocSizeOf for VariableValue
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 PartialEq for VariableValue
impl PartialEq for VariableValue
Source§impl ToComputedValue for VariableValue
impl ToComputedValue for VariableValue
Source§type ComputedValue = VariableValue
type ComputedValue = VariableValue
The computed value type we’re going to be converted to.
Source§fn to_computed_value(&self, _: &Context<'_>) -> Self
fn to_computed_value(&self, _: &Context<'_>) -> Self
Convert a specified value to a computed value, using itself and the data
inside the
Context
.Source§fn from_computed_value(other: &Self) -> Self
fn from_computed_value(other: &Self) -> Self
Convert a computed value to specified value form. Read more
Source§impl ToResolvedValue for VariableValue
impl ToResolvedValue for VariableValue
Source§type ResolvedValue = VariableValue
type ResolvedValue = VariableValue
The resolved value type we’re going to be converted to.
Source§fn to_resolved_value(self, _: &Context<'_>) -> Self
fn to_resolved_value(self, _: &Context<'_>) -> Self
Convert a resolved value to a resolved value.
Source§fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
Convert a resolved value to resolved value form.