pub struct VarFunction {
pub name: SubstitutionArgument<CustomPropertyName>,
pub fallback: Option<ArbitraryDeclarationValue>,
}Expand description
Data specific to a var() function.
Fields§
§name: SubstitutionArgument<CustomPropertyName>The referenced custom property name.
fallback: Option<ArbitraryDeclarationValue>The fallback for this function, if any.
Implementations§
Source§impl VarFunction
impl VarFunction
Sourcepub fn parse(
input: &mut Parser<'_>,
context: &mut SubstitutionParserContext<'_>,
) -> Result<Self, ParseError>
pub fn parse( input: &mut Parser<'_>, context: &mut SubstitutionParserContext<'_>, ) -> Result<Self, ParseError>
Parses the var() function arguments according to its argument grammar and syntax:
= var( , ?) - var() = var(
, ?)
Sourcepub fn replace<'a>(
&'a self,
source: &'a VariableValue,
context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>,
) -> Result<Substitution<'a>, ()>
pub fn replace<'a>( &'a self, source: &'a VariableValue, context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>, ) -> Result<Substitution<'a>, ()>
Replaces the var() function with its substitution value.
https://drafts.csswg.org/css-variables-2/#replace-a-var-function
fn resolve_custom_property<'a>( name: &Name, context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>, ) -> Option<Substitution<'a>>
Sourcepub fn replace_name<'a>(
&'a self,
source: &'a VariableValue,
context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>,
) -> ParsedArgument<'a, CustomPropertyName>
pub fn replace_name<'a>( &'a self, source: &'a VariableValue, context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>, ) -> ParsedArgument<'a, CustomPropertyName>
Returns the name, substituting and parsing it first if it has references.
Sourcepub fn for_each_unparsed_value<F>(&self, f: F)where
F: FnMut(&ArbitraryDeclarationValue),
pub fn for_each_unparsed_value<F>(&self, f: F)where
F: FnMut(&ArbitraryDeclarationValue),
Calls f for each arbitrary declaration value nested in the function.
Trait Implementations§
Source§impl Clone for VarFunction
impl Clone for VarFunction
Source§fn clone(&self) -> VarFunction
fn clone(&self) -> VarFunction
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 VarFunction
impl Debug for VarFunction
Source§impl MallocSizeOf for VarFunction
impl MallocSizeOf for VarFunction
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 VarFunction
impl PartialEq for VarFunction
impl StructuralPartialEq for VarFunction
Source§impl ToShmem for VarFunction
impl ToShmem for VarFunction
Auto Trait Implementations§
impl Freeze for VarFunction
impl RefUnwindSafe for VarFunction
impl Send for VarFunction
impl Sync for VarFunction
impl Unpin for VarFunction
impl UnsafeUnpin for VarFunction
impl UnwindSafe for VarFunction
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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