pub trait Fold {
Show 21 methods
// Provided methods
fn fold_atom(&mut self, node: Atom) -> Atom { ... }
fn fold_attribute(&mut self, node: Attribute) -> Attribute { ... }
fn fold_attribute_token(&mut self, node: AttributeToken) -> AttributeToken { ... }
fn fold_attribute_tokens(
&mut self,
node: Vec<AttributeToken>,
) -> Vec<AttributeToken> { ... }
fn fold_attributes(&mut self, node: Vec<Attribute>) -> Vec<Attribute> { ... }
fn fold_cdata_section(&mut self, node: CdataSection) -> CdataSection { ... }
fn fold_child(&mut self, node: Child) -> Child { ... }
fn fold_childs(&mut self, node: Vec<Child>) -> Vec<Child> { ... }
fn fold_comment(&mut self, node: Comment) -> Comment { ... }
fn fold_document(&mut self, node: Document) -> Document { ... }
fn fold_document_mode(&mut self, node: DocumentMode) -> DocumentMode { ... }
fn fold_document_type(&mut self, node: DocumentType) -> DocumentType { ... }
fn fold_element(&mut self, node: Element) -> Element { ... }
fn fold_namespace(&mut self, node: Namespace) -> Namespace { ... }
fn fold_opt_atom(&mut self, node: Option<Atom>) -> Option<Atom> { ... }
fn fold_opt_namespace(
&mut self,
node: Option<Namespace>,
) -> Option<Namespace> { ... }
fn fold_processing_instruction(
&mut self,
node: ProcessingInstruction,
) -> ProcessingInstruction { ... }
fn fold_span(&mut self, node: Span) -> Span { ... }
fn fold_text(&mut self, node: Text) -> Text { ... }
fn fold_token(&mut self, node: Token) -> Token { ... }
fn fold_token_and_span(&mut self, node: TokenAndSpan) -> TokenAndSpan { ... }
}
Expand description
A visitor trait for traversing the AST.
Provided Methods§
sourcefn fold_atom(&mut self, node: Atom) -> Atom
fn fold_atom(&mut self, node: Atom) -> Atom
Visit a node of type swc_atoms :: Atom
.
By default, this method calls [swc_atoms :: Atom::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_attribute(&mut self, node: Attribute) -> Attribute
fn fold_attribute(&mut self, node: Attribute) -> Attribute
Visit a node of type Attribute
.
By default, this method calls [Attribute::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_attribute_token(&mut self, node: AttributeToken) -> AttributeToken
fn fold_attribute_token(&mut self, node: AttributeToken) -> AttributeToken
Visit a node of type AttributeToken
.
By default, this method calls [AttributeToken::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_attribute_tokens(
&mut self,
node: Vec<AttributeToken>,
) -> Vec<AttributeToken>
fn fold_attribute_tokens( &mut self, node: Vec<AttributeToken>, ) -> Vec<AttributeToken>
Visit a node of type Vec < AttributeToken >
.
By default, this method calls [Vec < AttributeToken >::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_attributes(&mut self, node: Vec<Attribute>) -> Vec<Attribute>
fn fold_attributes(&mut self, node: Vec<Attribute>) -> Vec<Attribute>
Visit a node of type Vec < Attribute >
.
By default, this method calls [Vec < Attribute >::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_cdata_section(&mut self, node: CdataSection) -> CdataSection
fn fold_cdata_section(&mut self, node: CdataSection) -> CdataSection
Visit a node of type CdataSection
.
By default, this method calls [CdataSection::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_child(&mut self, node: Child) -> Child
fn fold_child(&mut self, node: Child) -> Child
Visit a node of type Child
.
By default, this method calls [Child::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_childs(&mut self, node: Vec<Child>) -> Vec<Child>
fn fold_childs(&mut self, node: Vec<Child>) -> Vec<Child>
Visit a node of type Vec < Child >
.
By default, this method calls [Vec < Child >::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_comment(&mut self, node: Comment) -> Comment
fn fold_comment(&mut self, node: Comment) -> Comment
Visit a node of type Comment
.
By default, this method calls [Comment::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_document(&mut self, node: Document) -> Document
fn fold_document(&mut self, node: Document) -> Document
Visit a node of type Document
.
By default, this method calls [Document::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_document_mode(&mut self, node: DocumentMode) -> DocumentMode
fn fold_document_mode(&mut self, node: DocumentMode) -> DocumentMode
Visit a node of type DocumentMode
.
By default, this method calls [DocumentMode::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_document_type(&mut self, node: DocumentType) -> DocumentType
fn fold_document_type(&mut self, node: DocumentType) -> DocumentType
Visit a node of type DocumentType
.
By default, this method calls [DocumentType::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_element(&mut self, node: Element) -> Element
fn fold_element(&mut self, node: Element) -> Element
Visit a node of type Element
.
By default, this method calls [Element::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_namespace(&mut self, node: Namespace) -> Namespace
fn fold_namespace(&mut self, node: Namespace) -> Namespace
Visit a node of type Namespace
.
By default, this method calls [Namespace::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_opt_atom(&mut self, node: Option<Atom>) -> Option<Atom>
fn fold_opt_atom(&mut self, node: Option<Atom>) -> Option<Atom>
Visit a node of type Option < swc_atoms :: Atom >
.
By default, this method calls [Option < swc_atoms :: Atom >::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_opt_namespace(&mut self, node: Option<Namespace>) -> Option<Namespace>
fn fold_opt_namespace(&mut self, node: Option<Namespace>) -> Option<Namespace>
Visit a node of type Option < Namespace >
.
By default, this method calls [Option < Namespace >::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_processing_instruction(
&mut self,
node: ProcessingInstruction,
) -> ProcessingInstruction
fn fold_processing_instruction( &mut self, node: ProcessingInstruction, ) -> ProcessingInstruction
Visit a node of type ProcessingInstruction
.
By default, this method calls [ProcessingInstruction::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_span(&mut self, node: Span) -> Span
fn fold_span(&mut self, node: Span) -> Span
Visit a node of type swc_common :: Span
.
By default, this method calls [swc_common :: Span::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_text(&mut self, node: Text) -> Text
fn fold_text(&mut self, node: Text) -> Text
Visit a node of type Text
.
By default, this method calls [Text::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_token(&mut self, node: Token) -> Token
fn fold_token(&mut self, node: Token) -> Token
Visit a node of type Token
.
By default, this method calls [Token::fold_children_with
]. If you want to recurse, you need to call it manually.
sourcefn fold_token_and_span(&mut self, node: TokenAndSpan) -> TokenAndSpan
fn fold_token_and_span(&mut self, node: TokenAndSpan) -> TokenAndSpan
Visit a node of type TokenAndSpan
.
By default, this method calls [TokenAndSpan::fold_children_with
]. If you want to recurse, you need to call it manually.