pub enum SubstDetails<O: SubstParseContext> {
Show 54 variants
tname(O::NotInBool),
ttype(O::NotInBool),
tdeftype(O::NotInBool),
vname(O::NotInBool),
fname(O::NotInBool),
ftype(O::NotInBool),
fpatname(O::NotInBool),
Vis(SubstVis, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat)),
tdefkwd(O::NotInBool),
vindex(O::NotInBool, Enabled),
findex(O::NotInBool, Enabled),
Xmeta(SubstMeta<O>),
tattrs(RawAttr, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
vattrs(RawAttr, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
fattrs(RawAttr, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
tgens((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat)),
tdefgens((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
tgnames((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
twheres((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
vpat(SubstVPat, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
vtype(SubstVType, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
tdefvariants(Template<TokenAccumulator>, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
fdefine(Option<Argument>, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
vdefbody(Argument<O>, Template<TokenAccumulator>, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
paste(Template<Items>, O::NotInBool),
paste_spanned(Argument, Argument<Items>, O::NotInBool, Enabled),
ChangeCase(Template<Items>, ChangeCase, ChangeCaseOkIn<O>),
concat(Template<Accumulator>, O::NotInBool, O::NotInPaste, Enabled),
when(Box<Subst<BooleanContext>>, O::NotInBool),
define(Definition<DefinitionBody>, O::NotInBool),
defcond(Definition<Box<Subst<BooleanContext>>>, O::NotInBool),
UserDefined(DefinitionName),
False(O::BoolOnly),
True(O::BoolOnly),
not(Box<Subst<BooleanContext>>, O::BoolOnly),
any(Punctuated<Subst<BooleanContext>, Comma>, O::BoolOnly),
all(Punctuated<Subst<BooleanContext>, Comma>, O::BoolOnly),
is_struct(O::BoolOnly),
is_enum(O::BoolOnly),
is_union(O::BoolOnly),
v_is_unit(O::BoolOnly),
v_is_tuple(O::BoolOnly),
v_is_named(O::BoolOnly),
is_empty(O::BoolOnly, Template<TokenAccumulator>),
approx_equal(O::BoolOnly, [Argument; 2]),
For(RepeatedTemplate<O>, O::NotInBool),
If(SubstIf<O>, O::NotInBool),
select1(SubstIf<O>, O::NotInBool),
ignore(Template<O>, O::NotInBool),
error(ExplicitError, O::NotInBool),
require_beta(Enabled, O::NotInBool),
dbg(DbgDumpRequest<O>),
dbg_all_keywords(O::NotInBool),
Crate((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool),
}Expand description
Enum representing nature and payload of a substitution
This is a single enum, for all of the different lexical contexts (principal expansion, identifier pasting, boolean predicates) because this:
- Unifies the parsing code, ensuring that all these constructs are parsed the same everywhere (unless we deviate deliberately).
- Mostly unifies the expansion and loop/conditional walking code.
- Avoids the need to recapitulate the keywords in multiple enums, or contexts with inner nested enums, or something.
The enum is generic over the lexical context SubstParseContext.
This allows the variants that are inapplicable in a particular
lexical context to be made uninhabited:
that ensures that detection of such errors occurs during template parsing.
Variants§
tname(O::NotInBool)
ttype(O::NotInBool)
tdeftype(O::NotInBool)
vname(O::NotInBool)
fname(O::NotInBool)
ftype(O::NotInBool)
fpatname(O::NotInBool)
Vis(SubstVis, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat))
tdefkwd(O::NotInBool)
vindex(O::NotInBool, Enabled)
findex(O::NotInBool, Enabled)
Xmeta(SubstMeta<O>)
tattrs(RawAttr, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
vattrs(RawAttr, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
fattrs(RawAttr, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
tgens((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat))
tdefgens((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
tgnames((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
twheres((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
vpat(SubstVPat, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
vtype(SubstVType, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
tdefvariants(Template<TokenAccumulator>, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
fdefine(Option<Argument>, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
vdefbody(Argument<O>, Template<TokenAccumulator>, (<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
paste(Template<Items>, O::NotInBool)
paste_spanned(Argument, Argument<Items>, O::NotInBool, Enabled)
ChangeCase(Template<Items>, ChangeCase, ChangeCaseOkIn<O>)
concat(Template<Accumulator>, O::NotInBool, O::NotInPaste, Enabled)
when(Box<Subst<BooleanContext>>, O::NotInBool)
define(Definition<DefinitionBody>, O::NotInBool)
defcond(Definition<Box<Subst<BooleanContext>>>, O::NotInBool)
UserDefined(DefinitionName)
False(O::BoolOnly)
True(O::BoolOnly)
not(Box<Subst<BooleanContext>>, O::BoolOnly)
any(Punctuated<Subst<BooleanContext>, Comma>, O::BoolOnly)
all(Punctuated<Subst<BooleanContext>, Comma>, O::BoolOnly)
is_struct(O::BoolOnly)
is_enum(O::BoolOnly)
is_union(O::BoolOnly)
v_is_unit(O::BoolOnly)
v_is_tuple(O::BoolOnly)
v_is_named(O::BoolOnly)
is_empty(O::BoolOnly, Template<TokenAccumulator>)
approx_equal(O::BoolOnly, [Argument; 2])
For(RepeatedTemplate<O>, O::NotInBool)
If(SubstIf<O>, O::NotInBool)
select1(SubstIf<O>, O::NotInBool)
ignore(Template<O>, O::NotInBool)
error(ExplicitError, O::NotInBool)
require_beta(Enabled, O::NotInBool)
dbg(DbgDumpRequest<O>)
dbg_all_keywords(O::NotInBool)
Crate((<O as SubstParseContext>::NotInPaste, <O as SubstParseContext>::NotInConcat), O::NotInBool)
Implementations§
Source§impl<O> SubstDetails<O>
impl<O> SubstDetails<O>
Sourcefn expand<'c>(
&self,
gctx: GeneralContext<'c>,
out: &mut O,
kw_span: Span,
) -> Result<()>
fn expand<'c>( &self, gctx: GeneralContext<'c>, out: &mut O, kw_span: Span, ) -> Result<()>
Expand this template element, by adding it to O
This is done using O’s ExpansionOutput methods.
Trait Implementations§
Source§impl<O: Debug + SubstParseContext> Debug for SubstDetails<O>
impl<O: Debug + SubstParseContext> Debug for SubstDetails<O>
Source§impl<O: SubstParseContext> FindRecogMetas for SubstDetails<O>
impl<O: SubstParseContext> FindRecogMetas for SubstDetails<O>
Source§fn find_recog_metas(&self, acc: &mut Recognised)
fn find_recog_metas(&self, acc: &mut Recognised)
Search for
fmeta(..) etc. expansions Read moreAuto Trait Implementations§
impl<O> Freeze for SubstDetails<O>where
<O as SubstParseContext>::NotInBool: Freeze,
<O as SubstParseContext>::NotInPaste: Freeze,
<O as SubstParseContext>::BoolOnly: Freeze,
<O as SubstParseContext>::NotInConcat: Freeze,
impl<O> RefUnwindSafe for SubstDetails<O>where
<O as SubstParseContext>::NotInBool: RefUnwindSafe,
<O as SubstParseContext>::NotInPaste: RefUnwindSafe,
<O as SubstParseContext>::BoolOnly: RefUnwindSafe,
<O as SubstParseContext>::NotInConcat: RefUnwindSafe,
<O as SubstParseContext>::DbgContent: RefUnwindSafe,
impl<O> !Send for SubstDetails<O>
impl<O> !Sync for SubstDetails<O>
impl<O> Unpin for SubstDetails<O>where
<O as SubstParseContext>::NotInBool: Unpin,
<O as SubstParseContext>::NotInPaste: Unpin,
<O as SubstParseContext>::BoolOnly: Unpin,
<O as SubstParseContext>::NotInConcat: Unpin,
impl<O> UnwindSafe for SubstDetails<O>where
<O as SubstParseContext>::NotInBool: UnwindSafe,
<O as SubstParseContext>::NotInPaste: UnwindSafe,
<O as SubstParseContext>::BoolOnly: UnwindSafe,
<O as SubstParseContext>::NotInConcat: UnwindSafe,
<O as SubstParseContext>::DbgContent: 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> 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 more