dprint_swc_ext::view

Trait NodeTrait

Source
pub trait NodeTrait<'a>: SourceRanged + Sized {
Show 28 methods // Required methods fn parent(&self) -> Option<Node<'a>>; fn children(&self) -> Vec<Node<'a>>; fn as_node(&self) -> Node<'a>; fn kind(&self) -> NodeKind; // Provided methods fn ancestors(&self) -> AncestorIterator<'a> { ... } fn start_line(&self) -> usize { ... } fn end_line(&self) -> usize { ... } fn start_column(&self) -> usize { ... } fn end_column(&self) -> usize { ... } fn char_width(&self) -> usize { ... } fn child_index(&self) -> usize { ... } fn previous_sibling(&self) -> Option<Node<'a>> { ... } fn previous_siblings(&self) -> Vec<Node<'a>> { ... } fn next_sibling(&self) -> Option<Node<'a>> { ... } fn next_siblings(&self) -> Vec<Node<'a>> { ... } fn tokens(&self) -> &'a [TokenAndSpan] { ... } fn children_with_tokens(&self) -> Vec<NodeOrToken<'a>> { ... } fn children_with_tokens_fast( &self, program: impl RootNode<'a>, ) -> Vec<NodeOrToken<'a>> { ... } fn leading_comments(&self) -> CommentsIterator<'a> { ... } fn trailing_comments(&self) -> CommentsIterator<'a> { ... } fn program(&self) -> Program<'a> { ... } fn module(&self) -> &Module<'a> { ... } fn script(&self) -> &Script<'a> { ... } fn text(&self) -> &'a str { ... } fn previous_token(&self) -> Option<&'a TokenAndSpan> { ... } fn next_token(&self) -> Option<&'a TokenAndSpan> { ... } fn previous_tokens(&self) -> &'a [TokenAndSpan] { ... } fn next_tokens(&self) -> &'a [TokenAndSpan] { ... }
}

Required Methods§

Source

fn parent(&self) -> Option<Node<'a>>

Source

fn children(&self) -> Vec<Node<'a>>

Source

fn as_node(&self) -> Node<'a>

Source

fn kind(&self) -> NodeKind

Provided Methods§

Source

fn ancestors(&self) -> AncestorIterator<'a>

Source

fn start_line(&self) -> usize

Source

fn end_line(&self) -> usize

Source

fn start_column(&self) -> usize

Source

fn end_column(&self) -> usize

Source

fn char_width(&self) -> usize

Source

fn child_index(&self) -> usize

Source

fn previous_sibling(&self) -> Option<Node<'a>>

Source

fn previous_siblings(&self) -> Vec<Node<'a>>

Gets the previous siblings in the order they appear in the file.

Source

fn next_sibling(&self) -> Option<Node<'a>>

Gets the next siblings in the order they appear in the file.

Source

fn next_siblings(&self) -> Vec<Node<'a>>

Source

fn tokens(&self) -> &'a [TokenAndSpan]

Source

fn children_with_tokens(&self) -> Vec<NodeOrToken<'a>>

Source

fn children_with_tokens_fast( &self, program: impl RootNode<'a>, ) -> Vec<NodeOrToken<'a>>

Source

fn leading_comments(&self) -> CommentsIterator<'a>

Source

fn trailing_comments(&self) -> CommentsIterator<'a>

Source

fn program(&self) -> Program<'a>

Gets the root node.

Source

fn module(&self) -> &Module<'a>

Gets the root node if the view was created from a Module; otherwise panics.

Source

fn script(&self) -> &Script<'a>

Gets the root node if the view was created from a Script; otherwise panics.

Source

fn text(&self) -> &'a str

Source

fn previous_token(&self) -> Option<&'a TokenAndSpan>

Source

fn next_token(&self) -> Option<&'a TokenAndSpan>

Source

fn previous_tokens(&self) -> &'a [TokenAndSpan]

Gets the previous tokens in the order they appear in the file.

Source

fn next_tokens(&self) -> &'a [TokenAndSpan]

Gets the next tokens in the order they appear in the file.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a> NodeTrait<'a> for AssignTarget<'a>

Source§

impl<'a> NodeTrait<'a> for AssignTargetPat<'a>

Source§

impl<'a> NodeTrait<'a> for BlockStmtOrExpr<'a>

Source§

impl<'a> NodeTrait<'a> for Callee<'a>

Source§

impl<'a> NodeTrait<'a> for ClassMember<'a>

Source§

impl<'a> NodeTrait<'a> for Decl<'a>

Source§

impl<'a> NodeTrait<'a> for DefaultDecl<'a>

Source§

impl<'a> NodeTrait<'a> for ExportSpecifier<'a>

Source§

impl<'a> NodeTrait<'a> for Expr<'a>

Source§

impl<'a> NodeTrait<'a> for ForHead<'a>

Source§

impl<'a> NodeTrait<'a> for ImportSpecifier<'a>

Source§

impl<'a> NodeTrait<'a> for JSXAttrName<'a>

Source§

impl<'a> NodeTrait<'a> for JSXAttrOrSpread<'a>

Source§

impl<'a> NodeTrait<'a> for JSXAttrValue<'a>

Source§

impl<'a> NodeTrait<'a> for JSXElementChild<'a>

Source§

impl<'a> NodeTrait<'a> for JSXElementName<'a>

Source§

impl<'a> NodeTrait<'a> for JSXExpr<'a>

Source§

impl<'a> NodeTrait<'a> for JSXObject<'a>

Source§

impl<'a> NodeTrait<'a> for Key<'a>

Source§

impl<'a> NodeTrait<'a> for Lit<'a>

Source§

impl<'a> NodeTrait<'a> for MemberProp<'a>

Source§

impl<'a> NodeTrait<'a> for ModuleDecl<'a>

Source§

impl<'a> NodeTrait<'a> for ModuleExportName<'a>

Source§

impl<'a> NodeTrait<'a> for ModuleItem<'a>

Source§

impl<'a> NodeTrait<'a> for Node<'a>

Source§

impl<'a> NodeTrait<'a> for ObjectPatProp<'a>

Source§

impl<'a> NodeTrait<'a> for OptChainBase<'a>

Source§

impl<'a> NodeTrait<'a> for ParamOrTsParamProp<'a>

Source§

impl<'a> NodeTrait<'a> for Pat<'a>

Source§

impl<'a> NodeTrait<'a> for Program<'a>

Source§

impl<'a> NodeTrait<'a> for Prop<'a>

Source§

impl<'a> NodeTrait<'a> for PropName<'a>

Source§

impl<'a> NodeTrait<'a> for PropOrSpread<'a>

Source§

impl<'a> NodeTrait<'a> for SimpleAssignTarget<'a>

Source§

impl<'a> NodeTrait<'a> for Stmt<'a>

Source§

impl<'a> NodeTrait<'a> for SuperProp<'a>

Source§

impl<'a> NodeTrait<'a> for TsEntityName<'a>

Source§

impl<'a> NodeTrait<'a> for TsEnumMemberId<'a>

Source§

impl<'a> NodeTrait<'a> for TsFnOrConstructorType<'a>

Source§

impl<'a> NodeTrait<'a> for TsFnParam<'a>

Source§

impl<'a> NodeTrait<'a> for TsLit<'a>

Source§

impl<'a> NodeTrait<'a> for TsModuleName<'a>

Source§

impl<'a> NodeTrait<'a> for TsModuleRef<'a>

Source§

impl<'a> NodeTrait<'a> for TsNamespaceBody<'a>

Source§

impl<'a> NodeTrait<'a> for TsParamPropParam<'a>

Source§

impl<'a> NodeTrait<'a> for TsThisTypeOrIdent<'a>

Source§

impl<'a> NodeTrait<'a> for TsType<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeElement<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeQueryExpr<'a>

Source§

impl<'a> NodeTrait<'a> for TsUnionOrIntersectionType<'a>

Source§

impl<'a> NodeTrait<'a> for VarDeclOrExpr<'a>

Source§

impl<'a> NodeTrait<'a> for ArrayLit<'a>

Source§

impl<'a> NodeTrait<'a> for ArrayPat<'a>

Source§

impl<'a> NodeTrait<'a> for ArrowExpr<'a>

Source§

impl<'a> NodeTrait<'a> for AssignExpr<'a>

Source§

impl<'a> NodeTrait<'a> for AssignPat<'a>

Source§

impl<'a> NodeTrait<'a> for AssignPatProp<'a>

Source§

impl<'a> NodeTrait<'a> for AssignProp<'a>

Source§

impl<'a> NodeTrait<'a> for AutoAccessor<'a>

Source§

impl<'a> NodeTrait<'a> for AwaitExpr<'a>

Source§

impl<'a> NodeTrait<'a> for BigInt<'a>

Source§

impl<'a> NodeTrait<'a> for BinExpr<'a>

Source§

impl<'a> NodeTrait<'a> for BindingIdent<'a>

Source§

impl<'a> NodeTrait<'a> for BlockStmt<'a>

Source§

impl<'a> NodeTrait<'a> for Bool<'a>

Source§

impl<'a> NodeTrait<'a> for BreakStmt<'a>

Source§

impl<'a> NodeTrait<'a> for CallExpr<'a>

Source§

impl<'a> NodeTrait<'a> for CatchClause<'a>

Source§

impl<'a> NodeTrait<'a> for Class<'a>

Source§

impl<'a> NodeTrait<'a> for ClassDecl<'a>

Source§

impl<'a> NodeTrait<'a> for ClassExpr<'a>

Source§

impl<'a> NodeTrait<'a> for ClassMethod<'a>

Source§

impl<'a> NodeTrait<'a> for ClassProp<'a>

Source§

impl<'a> NodeTrait<'a> for ComputedPropName<'a>

Source§

impl<'a> NodeTrait<'a> for CondExpr<'a>

Source§

impl<'a> NodeTrait<'a> for Constructor<'a>

Source§

impl<'a> NodeTrait<'a> for ContinueStmt<'a>

Source§

impl<'a> NodeTrait<'a> for DebuggerStmt<'a>

Source§

impl<'a> NodeTrait<'a> for Decorator<'a>

Source§

impl<'a> NodeTrait<'a> for DoWhileStmt<'a>

Source§

impl<'a> NodeTrait<'a> for EmptyStmt<'a>

Source§

impl<'a> NodeTrait<'a> for ExportAll<'a>

Source§

impl<'a> NodeTrait<'a> for ExportDecl<'a>

Source§

impl<'a> NodeTrait<'a> for ExportDefaultDecl<'a>

Source§

impl<'a> NodeTrait<'a> for ExportDefaultExpr<'a>

Source§

impl<'a> NodeTrait<'a> for ExportDefaultSpecifier<'a>

Source§

impl<'a> NodeTrait<'a> for ExportNamedSpecifier<'a>

Source§

impl<'a> NodeTrait<'a> for ExportNamespaceSpecifier<'a>

Source§

impl<'a> NodeTrait<'a> for ExprOrSpread<'a>

Source§

impl<'a> NodeTrait<'a> for ExprStmt<'a>

Source§

impl<'a> NodeTrait<'a> for FnDecl<'a>

Source§

impl<'a> NodeTrait<'a> for FnExpr<'a>

Source§

impl<'a> NodeTrait<'a> for ForInStmt<'a>

Source§

impl<'a> NodeTrait<'a> for ForOfStmt<'a>

Source§

impl<'a> NodeTrait<'a> for ForStmt<'a>

Source§

impl<'a> NodeTrait<'a> for Function<'a>

Source§

impl<'a> NodeTrait<'a> for GetterProp<'a>

Source§

impl<'a> NodeTrait<'a> for Ident<'a>

Source§

impl<'a> NodeTrait<'a> for IdentName<'a>

Source§

impl<'a> NodeTrait<'a> for IfStmt<'a>

Source§

impl<'a> NodeTrait<'a> for Import<'a>

Source§

impl<'a> NodeTrait<'a> for ImportDecl<'a>

Source§

impl<'a> NodeTrait<'a> for ImportDefaultSpecifier<'a>

Source§

impl<'a> NodeTrait<'a> for ImportNamedSpecifier<'a>

Source§

impl<'a> NodeTrait<'a> for ImportStarAsSpecifier<'a>

Source§

impl<'a> NodeTrait<'a> for Invalid<'a>

Source§

impl<'a> NodeTrait<'a> for JSXAttr<'a>

Source§

impl<'a> NodeTrait<'a> for JSXClosingElement<'a>

Source§

impl<'a> NodeTrait<'a> for JSXClosingFragment<'a>

Source§

impl<'a> NodeTrait<'a> for JSXElement<'a>

Source§

impl<'a> NodeTrait<'a> for JSXEmptyExpr<'a>

Source§

impl<'a> NodeTrait<'a> for JSXExprContainer<'a>

Source§

impl<'a> NodeTrait<'a> for JSXFragment<'a>

Source§

impl<'a> NodeTrait<'a> for JSXMemberExpr<'a>

Source§

impl<'a> NodeTrait<'a> for JSXNamespacedName<'a>

Source§

impl<'a> NodeTrait<'a> for JSXOpeningElement<'a>

Source§

impl<'a> NodeTrait<'a> for JSXOpeningFragment<'a>

Source§

impl<'a> NodeTrait<'a> for JSXSpreadChild<'a>

Source§

impl<'a> NodeTrait<'a> for JSXText<'a>

Source§

impl<'a> NodeTrait<'a> for KeyValuePatProp<'a>

Source§

impl<'a> NodeTrait<'a> for KeyValueProp<'a>

Source§

impl<'a> NodeTrait<'a> for LabeledStmt<'a>

Source§

impl<'a> NodeTrait<'a> for MemberExpr<'a>

Source§

impl<'a> NodeTrait<'a> for MetaPropExpr<'a>

Source§

impl<'a> NodeTrait<'a> for MethodProp<'a>

Source§

impl<'a> NodeTrait<'a> for Module<'a>

Source§

impl<'a> NodeTrait<'a> for NamedExport<'a>

Source§

impl<'a> NodeTrait<'a> for NewExpr<'a>

Source§

impl<'a> NodeTrait<'a> for Null<'a>

Source§

impl<'a> NodeTrait<'a> for Number<'a>

Source§

impl<'a> NodeTrait<'a> for ObjectLit<'a>

Source§

impl<'a> NodeTrait<'a> for ObjectPat<'a>

Source§

impl<'a> NodeTrait<'a> for OptCall<'a>

Source§

impl<'a> NodeTrait<'a> for OptChainExpr<'a>

Source§

impl<'a> NodeTrait<'a> for Param<'a>

Source§

impl<'a> NodeTrait<'a> for ParenExpr<'a>

Source§

impl<'a> NodeTrait<'a> for PrivateMethod<'a>

Source§

impl<'a> NodeTrait<'a> for PrivateName<'a>

Source§

impl<'a> NodeTrait<'a> for PrivateProp<'a>

Source§

impl<'a> NodeTrait<'a> for Regex<'a>

Source§

impl<'a> NodeTrait<'a> for RestPat<'a>

Source§

impl<'a> NodeTrait<'a> for ReturnStmt<'a>

Source§

impl<'a> NodeTrait<'a> for Script<'a>

Source§

impl<'a> NodeTrait<'a> for SeqExpr<'a>

Source§

impl<'a> NodeTrait<'a> for SetterProp<'a>

Source§

impl<'a> NodeTrait<'a> for SpreadElement<'a>

Source§

impl<'a> NodeTrait<'a> for StaticBlock<'a>

Source§

impl<'a> NodeTrait<'a> for Str<'a>

Source§

impl<'a> NodeTrait<'a> for Super<'a>

Source§

impl<'a> NodeTrait<'a> for SuperPropExpr<'a>

Source§

impl<'a> NodeTrait<'a> for SwitchCase<'a>

Source§

impl<'a> NodeTrait<'a> for SwitchStmt<'a>

Source§

impl<'a> NodeTrait<'a> for TaggedTpl<'a>

Source§

impl<'a> NodeTrait<'a> for ThisExpr<'a>

Source§

impl<'a> NodeTrait<'a> for ThrowStmt<'a>

Source§

impl<'a> NodeTrait<'a> for Tpl<'a>

Source§

impl<'a> NodeTrait<'a> for TplElement<'a>

Source§

impl<'a> NodeTrait<'a> for TryStmt<'a>

Source§

impl<'a> NodeTrait<'a> for TsArrayType<'a>

Source§

impl<'a> NodeTrait<'a> for TsAsExpr<'a>

Source§

impl<'a> NodeTrait<'a> for TsCallSignatureDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsConditionalType<'a>

Source§

impl<'a> NodeTrait<'a> for TsConstAssertion<'a>

Source§

impl<'a> NodeTrait<'a> for TsConstructSignatureDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsConstructorType<'a>

Source§

impl<'a> NodeTrait<'a> for TsEnumDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsEnumMember<'a>

Source§

impl<'a> NodeTrait<'a> for TsExportAssignment<'a>

Source§

impl<'a> NodeTrait<'a> for TsExprWithTypeArgs<'a>

Source§

impl<'a> NodeTrait<'a> for TsExternalModuleRef<'a>

Source§

impl<'a> NodeTrait<'a> for TsFnType<'a>

Source§

impl<'a> NodeTrait<'a> for TsGetterSignature<'a>

Source§

impl<'a> NodeTrait<'a> for TsImportEqualsDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsImportType<'a>

Source§

impl<'a> NodeTrait<'a> for TsIndexSignature<'a>

Source§

impl<'a> NodeTrait<'a> for TsIndexedAccessType<'a>

Source§

impl<'a> NodeTrait<'a> for TsInferType<'a>

Source§

impl<'a> NodeTrait<'a> for TsInstantiation<'a>

Source§

impl<'a> NodeTrait<'a> for TsInterfaceBody<'a>

Source§

impl<'a> NodeTrait<'a> for TsInterfaceDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsIntersectionType<'a>

Source§

impl<'a> NodeTrait<'a> for TsKeywordType<'a>

Source§

impl<'a> NodeTrait<'a> for TsLitType<'a>

Source§

impl<'a> NodeTrait<'a> for TsMappedType<'a>

Source§

impl<'a> NodeTrait<'a> for TsMethodSignature<'a>

Source§

impl<'a> NodeTrait<'a> for TsModuleBlock<'a>

Source§

impl<'a> NodeTrait<'a> for TsModuleDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsNamespaceDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsNamespaceExportDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsNonNullExpr<'a>

Source§

impl<'a> NodeTrait<'a> for TsOptionalType<'a>

Source§

impl<'a> NodeTrait<'a> for TsParamProp<'a>

Source§

impl<'a> NodeTrait<'a> for TsParenthesizedType<'a>

Source§

impl<'a> NodeTrait<'a> for TsPropertySignature<'a>

Source§

impl<'a> NodeTrait<'a> for TsQualifiedName<'a>

Source§

impl<'a> NodeTrait<'a> for TsRestType<'a>

Source§

impl<'a> NodeTrait<'a> for TsSatisfiesExpr<'a>

Source§

impl<'a> NodeTrait<'a> for TsSetterSignature<'a>

Source§

impl<'a> NodeTrait<'a> for TsThisType<'a>

Source§

impl<'a> NodeTrait<'a> for TsTplLitType<'a>

Source§

impl<'a> NodeTrait<'a> for TsTupleElement<'a>

Source§

impl<'a> NodeTrait<'a> for TsTupleType<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeAliasDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeAnn<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeAssertion<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeLit<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeOperator<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeParam<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeParamDecl<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeParamInstantiation<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypePredicate<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeQuery<'a>

Source§

impl<'a> NodeTrait<'a> for TsTypeRef<'a>

Source§

impl<'a> NodeTrait<'a> for TsUnionType<'a>

Source§

impl<'a> NodeTrait<'a> for UnaryExpr<'a>

Source§

impl<'a> NodeTrait<'a> for UpdateExpr<'a>

Source§

impl<'a> NodeTrait<'a> for UsingDecl<'a>

Source§

impl<'a> NodeTrait<'a> for VarDecl<'a>

Source§

impl<'a> NodeTrait<'a> for VarDeclarator<'a>

Source§

impl<'a> NodeTrait<'a> for WhileStmt<'a>

Source§

impl<'a> NodeTrait<'a> for WithStmt<'a>

Source§

impl<'a> NodeTrait<'a> for YieldExpr<'a>