pub struct StructDecl(pub Box<TopBinding>);Expand description
One declaration inside a module ... = struct ... end body (nxstruct).
nxstruct’s alternatives are a strict subset of nxtoplevel’s (every
form it has, TopBinding also has, once Module/Open are added), so
this simply re-parses a TopBinding — but not by naming TopBinding
as a field type directly: TopBinding lives outside the
#[recurse] module, so TopBinding -> Module -> Vec<StructDecl> -> TopBinding would be a self-recursive cycle through a plain
#[derive(Parse)], which (without the #[recurse] engine to back it)
is an E0275 hazard (an unbounded recursive trait-bound obligation).
Hand-writing Parse/Unparse here — the same trick as
ExprErased et al. — sidesteps that: the impl has no recursive
where-bound for the compiler to try to satisfy, it just calls
TopBinding::parse through the stream-erasing adapter at runtime.
Tuple Fields§
§0: Box<TopBinding>Trait Implementations§
Source§impl Clone for StructDecl
impl Clone for StructDecl
Source§fn clone(&self) -> StructDecl
fn clone(&self) -> StructDecl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StructDecl
impl Debug for StructDecl
Source§impl Parse<WithSpan<Token, Span>> for StructDecl
impl Parse<WithSpan<Token, Span>> for StructDecl
Source§type Error = ParseError<Span>
type Error = ParseError<Span>
<FieldTy as Parse<Atom>>::Error: Into<…> predicate re-creates a projection cycle on a
recursive field (E0275), which decycle’s bound-peeling does not break.