pub struct AttrFunction {
pub arg: SubstitutionArgument<AttrArgument>,
pub fallback: Option<ArbitraryDeclarationValue>,
namespaces: Option<FxHashMap<Prefix, Namespace>>,
}Expand description
Data specific to an attr() function.
Fields§
§arg: SubstitutionArgument<AttrArgument>The referenced attribute name and optional type.
fallback: Option<ArbitraryDeclarationValue>The fallback for this function, if any.
namespaces: Option<FxHashMap<Prefix, Namespace>>The namespace prefixes in scope where the function was parsed.
Implementations§
Source§impl AttrFunction
impl AttrFunction
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 attr() function arguments according to its argument grammar and syntax:
= attr( , ?) - attr() = attr(
? , ?)
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 attr() function with its substitution value.
https://drafts.csswg.org/css-values-5/#replace-an-attr-function
Sourcepub fn replace_arg<'a>(
&'a self,
source: &'a VariableValue,
context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>,
) -> ParsedArgument<'a, AttrArgument>
pub fn replace_arg<'a>( &'a self, source: &'a VariableValue, context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>, ) -> ParsedArgument<'a, AttrArgument>
Returns the argument, 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 AttrFunction
impl Clone for AttrFunction
Source§fn clone(&self) -> AttrFunction
fn clone(&self) -> AttrFunction
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 AttrFunction
impl Debug for AttrFunction
Source§impl MallocSizeOf for AttrFunction
impl MallocSizeOf for AttrFunction
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 AttrFunction
impl PartialEq for AttrFunction
impl StructuralPartialEq for AttrFunction
Source§impl ToShmem for AttrFunction
impl ToShmem for AttrFunction
Auto Trait Implementations§
impl Freeze for AttrFunction
impl RefUnwindSafe for AttrFunction
impl Send for AttrFunction
impl Sync for AttrFunction
impl Unpin for AttrFunction
impl UnsafeUnpin for AttrFunction
impl UnwindSafe for AttrFunction
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