pub trait AstDebug {
// Required method
fn ast_debug(&self, w: &mut AstWriter);
}
Expand description
Simple trait used for pretty printing the various AST
Unfortunately, the trait implementation cannot be derived. The actual implementation should closely resemble the source syntax. As suchfield does not get printed in a direct manner, and most of the logic is ad hoc
To avoid missing fields in the printing, be sure to fully pattern match against the struct
(without the use of ..
) when implementing AstDebug
. For example,
ⓘ
impl AstDebug for StructDefinition {
fn ast_debug(&self, w: &mut AstWriter) {
let StructDefinition {
resource_opt,
name,
type_parameters,
fields,
} = self;
...
}
}