pub enum SubstitutionArgument<T> {
Unparsed(ArbitraryDeclarationValue),
Parsed(T),
Invalid,
}Expand description
An argument of a substitution function that is parsed as T at substitution time.
Variants§
Unparsed(ArbitraryDeclarationValue)
The argument in its <declaration-value> form with nested substitution functions.
Parsed(T)
The argument successfully parsed as T at parse time.
Invalid
The argument is a valid <declaration-value> and contains no nested substitution
functions, but is not a valid T.
Implementations§
Source§impl<T: Parse> SubstitutionArgument<T>
impl<T: Parse> SubstitutionArgument<T>
Sourcepub fn try_parse(
input: &mut Parser<'_>,
context: &mut SubstitutionParserContext<'_>,
delimiters: Delimiters,
) -> Result<Self, ParseError>
pub fn try_parse( input: &mut Parser<'_>, context: &mut SubstitutionParserContext<'_>, delimiters: Delimiters, ) -> Result<Self, ParseError>
Parses the argument as a <declaration-value>. If it has no nested substitution
functions, it is also parsed right away, giving Parsed or Invalid; otherwise
it is kept as Unparsed, to be parsed at substitution time.
Source§impl<T: Clone + Parse> SubstitutionArgument<T>
impl<T: Clone + Parse> SubstitutionArgument<T>
Sourcepub fn substitute_and_parse<'a>(
&'a self,
source: &'a VariableValue,
context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>,
) -> ParsedArgument<'a, T>
pub fn substitute_and_parse<'a>( &'a self, source: &'a VariableValue, context: &mut SubstitutionReplacementContext<'a, '_, '_, '_>, ) -> ParsedArgument<'a, T>
Returns the argument, first substituting its nested references and
parsing it into T via parse if it is Unparsed.
Trait Implementations§
Source§impl<T: Clone> Clone for SubstitutionArgument<T>
impl<T: Clone> Clone for SubstitutionArgument<T>
Source§fn clone(&self) -> SubstitutionArgument<T>
fn clone(&self) -> SubstitutionArgument<T>
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<T: Debug> Debug for SubstitutionArgument<T>
impl<T: Debug> Debug for SubstitutionArgument<T>
Source§impl<T> MallocSizeOf for SubstitutionArgument<T>where
T: MallocSizeOf,
impl<T> MallocSizeOf for SubstitutionArgument<T>where
T: MallocSizeOf,
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<T: PartialEq> PartialEq for SubstitutionArgument<T>
impl<T: PartialEq> PartialEq for SubstitutionArgument<T>
impl<T: PartialEq> StructuralPartialEq for SubstitutionArgument<T>
Auto Trait Implementations§
impl<T> Freeze for SubstitutionArgument<T>where
T: Freeze,
impl<T> RefUnwindSafe for SubstitutionArgument<T>where
T: RefUnwindSafe,
impl<T> Send for SubstitutionArgument<T>where
T: Send,
impl<T> Sync for SubstitutionArgument<T>where
T: Sync,
impl<T> Unpin for SubstitutionArgument<T>where
T: Unpin,
impl<T> UnsafeUnpin for SubstitutionArgument<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for SubstitutionArgument<T>where
T: UnwindSafe,
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