pub struct EnvFunction {
pub name: SubstitutionArgument<EnvName>,
pub fallback: Option<ArbitraryDeclarationValue>,
}Expand description
Data specific to an env() function.
Fields§
§name: SubstitutionArgument<EnvName>The referenced environment variable name.
fallback: Option<ArbitraryDeclarationValue>The fallback for this function, if any.
Implementations§
Source§impl EnvFunction
impl EnvFunction
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 env() function arguments according to its argument grammar and syntax:
= env( , ?) - env() = env(
<integer [0,∞]>*, ?)
TODO(Bug 2081127) - Support the optional index arguments.
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 env() function with its substitution value.
https://drafts.csswg.org/css-env-1/#substitute-an-env
Sourcepub fn replace_name<'a>(
&'a self,
source: &'a VariableValue,
context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>,
) -> ParsedArgument<'a, EnvName>
pub fn replace_name<'a>( &'a self, source: &'a VariableValue, context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>, ) -> ParsedArgument<'a, EnvName>
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 EnvFunction
impl Clone for EnvFunction
Source§fn clone(&self) -> EnvFunction
fn clone(&self) -> EnvFunction
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 EnvFunction
impl Debug for EnvFunction
Source§impl MallocSizeOf for EnvFunction
impl MallocSizeOf for EnvFunction
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 EnvFunction
impl PartialEq for EnvFunction
impl StructuralPartialEq for EnvFunction
Source§impl ToShmem for EnvFunction
impl ToShmem for EnvFunction
Auto Trait Implementations§
impl Freeze for EnvFunction
impl RefUnwindSafe for EnvFunction
impl Send for EnvFunction
impl Sync for EnvFunction
impl Unpin for EnvFunction
impl UnsafeUnpin for EnvFunction
impl UnwindSafe for EnvFunction
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