Skip to main content

AstKind

Enum AstKind 

Source
#[repr(C, u8)]
pub enum AstKind<'a> {
Show 188 variants Program(&'a Program<'a>), IdentifierName(&'a IdentifierName<'a>), IdentifierReference(&'a IdentifierReference<'a>), BindingIdentifier(&'a BindingIdentifier<'a>), LabelIdentifier(&'a LabelIdentifier<'a>), ThisExpression(&'a ThisExpression), ArrayExpression(&'a ArrayExpression<'a>), Elision(&'a Elision), ObjectExpression(&'a ObjectExpression<'a>), ObjectProperty(&'a ObjectProperty<'a>), TemplateLiteral(&'a TemplateLiteral<'a>), TaggedTemplateExpression(&'a TaggedTemplateExpression<'a>), TemplateElement(&'a TemplateElement<'a>), ComputedMemberExpression(&'a ComputedMemberExpression<'a>), StaticMemberExpression(&'a StaticMemberExpression<'a>), PrivateFieldExpression(&'a PrivateFieldExpression<'a>), CallExpression(&'a CallExpression<'a>), NewExpression(&'a NewExpression<'a>), MetaProperty(&'a MetaProperty<'a>), SpreadElement(&'a SpreadElement<'a>), UpdateExpression(&'a UpdateExpression<'a>), UnaryExpression(&'a UnaryExpression<'a>), BinaryExpression(&'a BinaryExpression<'a>), PrivateInExpression(&'a PrivateInExpression<'a>), LogicalExpression(&'a LogicalExpression<'a>), ConditionalExpression(&'a ConditionalExpression<'a>), AssignmentExpression(&'a AssignmentExpression<'a>), ArrayAssignmentTarget(&'a ArrayAssignmentTarget<'a>), ObjectAssignmentTarget(&'a ObjectAssignmentTarget<'a>), AssignmentTargetRest(&'a AssignmentTargetRest<'a>), AssignmentTargetWithDefault(&'a AssignmentTargetWithDefault<'a>), AssignmentTargetPropertyIdentifier(&'a AssignmentTargetPropertyIdentifier<'a>), AssignmentTargetPropertyProperty(&'a AssignmentTargetPropertyProperty<'a>), SequenceExpression(&'a SequenceExpression<'a>), Super(&'a Super), AwaitExpression(&'a AwaitExpression<'a>), ChainExpression(&'a ChainExpression<'a>), ParenthesizedExpression(&'a ParenthesizedExpression<'a>), Directive(&'a Directive<'a>), Hashbang(&'a Hashbang<'a>), BlockStatement(&'a BlockStatement<'a>), VariableDeclaration(&'a VariableDeclaration<'a>), VariableDeclarator(&'a VariableDeclarator<'a>), EmptyStatement(&'a EmptyStatement), ExpressionStatement(&'a ExpressionStatement<'a>), IfStatement(&'a IfStatement<'a>), DoWhileStatement(&'a DoWhileStatement<'a>), WhileStatement(&'a WhileStatement<'a>), ForStatement(&'a ForStatement<'a>), ForInStatement(&'a ForInStatement<'a>), ForOfStatement(&'a ForOfStatement<'a>), ContinueStatement(&'a ContinueStatement<'a>), BreakStatement(&'a BreakStatement<'a>), ReturnStatement(&'a ReturnStatement<'a>), WithStatement(&'a WithStatement<'a>), SwitchStatement(&'a SwitchStatement<'a>), SwitchCase(&'a SwitchCase<'a>), LabeledStatement(&'a LabeledStatement<'a>), ThrowStatement(&'a ThrowStatement<'a>), TryStatement(&'a TryStatement<'a>), CatchClause(&'a CatchClause<'a>), CatchParameter(&'a CatchParameter<'a>), DebuggerStatement(&'a DebuggerStatement), AssignmentPattern(&'a AssignmentPattern<'a>), ObjectPattern(&'a ObjectPattern<'a>), BindingProperty(&'a BindingProperty<'a>), ArrayPattern(&'a ArrayPattern<'a>), BindingRestElement(&'a BindingRestElement<'a>), Function(&'a Function<'a>), FormalParameters(&'a FormalParameters<'a>), FormalParameter(&'a FormalParameter<'a>), FormalParameterRest(&'a FormalParameterRest<'a>), FunctionBody(&'a FunctionBody<'a>), ArrowFunctionExpression(&'a ArrowFunctionExpression<'a>), YieldExpression(&'a YieldExpression<'a>), Class(&'a Class<'a>), ClassBody(&'a ClassBody<'a>), MethodDefinition(&'a MethodDefinition<'a>), PropertyDefinition(&'a PropertyDefinition<'a>), PrivateIdentifier(&'a PrivateIdentifier<'a>), StaticBlock(&'a StaticBlock<'a>), AccessorProperty(&'a AccessorProperty<'a>), ImportExpression(&'a ImportExpression<'a>), ImportDeclaration(&'a ImportDeclaration<'a>), ImportSpecifier(&'a ImportSpecifier<'a>), ImportDefaultSpecifier(&'a ImportDefaultSpecifier<'a>), ImportNamespaceSpecifier(&'a ImportNamespaceSpecifier<'a>), WithClause(&'a WithClause<'a>), ImportAttribute(&'a ImportAttribute<'a>), ExportNamedDeclaration(&'a ExportNamedDeclaration<'a>), ExportDefaultDeclaration(&'a ExportDefaultDeclaration<'a>), ExportAllDeclaration(&'a ExportAllDeclaration<'a>), ExportSpecifier(&'a ExportSpecifier<'a>), V8IntrinsicExpression(&'a V8IntrinsicExpression<'a>), BooleanLiteral(&'a BooleanLiteral), NullLiteral(&'a NullLiteral), NumericLiteral(&'a NumericLiteral<'a>), StringLiteral(&'a StringLiteral<'a>), BigIntLiteral(&'a BigIntLiteral<'a>), RegExpLiteral(&'a RegExpLiteral<'a>), JSXElement(&'a JSXElement<'a>), JSXOpeningElement(&'a JSXOpeningElement<'a>), JSXClosingElement(&'a JSXClosingElement<'a>), JSXFragment(&'a JSXFragment<'a>), JSXOpeningFragment(&'a JSXOpeningFragment), JSXClosingFragment(&'a JSXClosingFragment), JSXNamespacedName(&'a JSXNamespacedName<'a>), JSXMemberExpression(&'a JSXMemberExpression<'a>), JSXExpressionContainer(&'a JSXExpressionContainer<'a>), JSXEmptyExpression(&'a JSXEmptyExpression), JSXAttribute(&'a JSXAttribute<'a>), JSXSpreadAttribute(&'a JSXSpreadAttribute<'a>), JSXIdentifier(&'a JSXIdentifier<'a>), JSXSpreadChild(&'a JSXSpreadChild<'a>), JSXText(&'a JSXText<'a>), TSThisParameter(&'a TSThisParameter<'a>), TSEnumDeclaration(&'a TSEnumDeclaration<'a>), TSEnumBody(&'a TSEnumBody<'a>), TSEnumMember(&'a TSEnumMember<'a>), TSTypeAnnotation(&'a TSTypeAnnotation<'a>), TSLiteralType(&'a TSLiteralType<'a>), TSConditionalType(&'a TSConditionalType<'a>), TSUnionType(&'a TSUnionType<'a>), TSIntersectionType(&'a TSIntersectionType<'a>), TSParenthesizedType(&'a TSParenthesizedType<'a>), TSTypeOperator(&'a TSTypeOperator<'a>), TSArrayType(&'a TSArrayType<'a>), TSIndexedAccessType(&'a TSIndexedAccessType<'a>), TSTupleType(&'a TSTupleType<'a>), TSNamedTupleMember(&'a TSNamedTupleMember<'a>), TSOptionalType(&'a TSOptionalType<'a>), TSRestType(&'a TSRestType<'a>), TSAnyKeyword(&'a TSAnyKeyword), TSStringKeyword(&'a TSStringKeyword), TSBooleanKeyword(&'a TSBooleanKeyword), TSNumberKeyword(&'a TSNumberKeyword), TSNeverKeyword(&'a TSNeverKeyword), TSIntrinsicKeyword(&'a TSIntrinsicKeyword), TSUnknownKeyword(&'a TSUnknownKeyword), TSNullKeyword(&'a TSNullKeyword), TSUndefinedKeyword(&'a TSUndefinedKeyword), TSVoidKeyword(&'a TSVoidKeyword), TSSymbolKeyword(&'a TSSymbolKeyword), TSThisType(&'a TSThisType), TSObjectKeyword(&'a TSObjectKeyword), TSBigIntKeyword(&'a TSBigIntKeyword), TSTypeReference(&'a TSTypeReference<'a>), TSQualifiedName(&'a TSQualifiedName<'a>), TSTypeParameterInstantiation(&'a TSTypeParameterInstantiation<'a>), TSTypeParameter(&'a TSTypeParameter<'a>), TSTypeParameterDeclaration(&'a TSTypeParameterDeclaration<'a>), TSTypeAliasDeclaration(&'a TSTypeAliasDeclaration<'a>), TSClassImplements(&'a TSClassImplements<'a>), TSInterfaceDeclaration(&'a TSInterfaceDeclaration<'a>), TSInterfaceBody(&'a TSInterfaceBody<'a>), TSPropertySignature(&'a TSPropertySignature<'a>), TSIndexSignature(&'a TSIndexSignature<'a>), TSCallSignatureDeclaration(&'a TSCallSignatureDeclaration<'a>), TSMethodSignature(&'a TSMethodSignature<'a>), TSConstructSignatureDeclaration(&'a TSConstructSignatureDeclaration<'a>), TSIndexSignatureName(&'a TSIndexSignatureName<'a>), TSInterfaceHeritage(&'a TSInterfaceHeritage<'a>), TSTypePredicate(&'a TSTypePredicate<'a>), TSModuleDeclaration(&'a TSModuleDeclaration<'a>), TSGlobalDeclaration(&'a TSGlobalDeclaration<'a>), TSModuleBlock(&'a TSModuleBlock<'a>), TSTypeLiteral(&'a TSTypeLiteral<'a>), TSInferType(&'a TSInferType<'a>), TSTypeQuery(&'a TSTypeQuery<'a>), TSImportType(&'a TSImportType<'a>), TSImportTypeQualifiedName(&'a TSImportTypeQualifiedName<'a>), TSFunctionType(&'a TSFunctionType<'a>), TSConstructorType(&'a TSConstructorType<'a>), TSMappedType(&'a TSMappedType<'a>), TSTemplateLiteralType(&'a TSTemplateLiteralType<'a>), TSAsExpression(&'a TSAsExpression<'a>), TSSatisfiesExpression(&'a TSSatisfiesExpression<'a>), TSTypeAssertion(&'a TSTypeAssertion<'a>), TSImportEqualsDeclaration(&'a TSImportEqualsDeclaration<'a>), TSExternalModuleReference(&'a TSExternalModuleReference<'a>), TSNonNullExpression(&'a TSNonNullExpression<'a>), Decorator(&'a Decorator<'a>), TSExportAssignment(&'a TSExportAssignment<'a>), TSNamespaceExportDeclaration(&'a TSNamespaceExportDeclaration<'a>), TSInstantiationExpression(&'a TSInstantiationExpression<'a>), JSDocNullableType(&'a JSDocNullableType<'a>), JSDocNonNullableType(&'a JSDocNonNullableType<'a>), JSDocUnknownType(&'a JSDocUnknownType),
}
Expand description

Untyped AST Node Kind

Variants§

§

Program(&'a Program<'a>)

§

IdentifierName(&'a IdentifierName<'a>)

§

IdentifierReference(&'a IdentifierReference<'a>)

§

BindingIdentifier(&'a BindingIdentifier<'a>)

§

LabelIdentifier(&'a LabelIdentifier<'a>)

§

ThisExpression(&'a ThisExpression)

§

ArrayExpression(&'a ArrayExpression<'a>)

§

Elision(&'a Elision)

§

ObjectExpression(&'a ObjectExpression<'a>)

§

ObjectProperty(&'a ObjectProperty<'a>)

§

TemplateLiteral(&'a TemplateLiteral<'a>)

§

TaggedTemplateExpression(&'a TaggedTemplateExpression<'a>)

§

TemplateElement(&'a TemplateElement<'a>)

§

ComputedMemberExpression(&'a ComputedMemberExpression<'a>)

§

StaticMemberExpression(&'a StaticMemberExpression<'a>)

§

PrivateFieldExpression(&'a PrivateFieldExpression<'a>)

§

CallExpression(&'a CallExpression<'a>)

§

NewExpression(&'a NewExpression<'a>)

§

MetaProperty(&'a MetaProperty<'a>)

§

SpreadElement(&'a SpreadElement<'a>)

§

UpdateExpression(&'a UpdateExpression<'a>)

§

UnaryExpression(&'a UnaryExpression<'a>)

§

BinaryExpression(&'a BinaryExpression<'a>)

§

PrivateInExpression(&'a PrivateInExpression<'a>)

§

LogicalExpression(&'a LogicalExpression<'a>)

§

ConditionalExpression(&'a ConditionalExpression<'a>)

§

AssignmentExpression(&'a AssignmentExpression<'a>)

§

ArrayAssignmentTarget(&'a ArrayAssignmentTarget<'a>)

§

ObjectAssignmentTarget(&'a ObjectAssignmentTarget<'a>)

§

AssignmentTargetRest(&'a AssignmentTargetRest<'a>)

§

AssignmentTargetWithDefault(&'a AssignmentTargetWithDefault<'a>)

§

AssignmentTargetPropertyIdentifier(&'a AssignmentTargetPropertyIdentifier<'a>)

§

AssignmentTargetPropertyProperty(&'a AssignmentTargetPropertyProperty<'a>)

§

SequenceExpression(&'a SequenceExpression<'a>)

§

Super(&'a Super)

§

AwaitExpression(&'a AwaitExpression<'a>)

§

ChainExpression(&'a ChainExpression<'a>)

§

ParenthesizedExpression(&'a ParenthesizedExpression<'a>)

§

Directive(&'a Directive<'a>)

§

Hashbang(&'a Hashbang<'a>)

§

BlockStatement(&'a BlockStatement<'a>)

§

VariableDeclaration(&'a VariableDeclaration<'a>)

§

VariableDeclarator(&'a VariableDeclarator<'a>)

§

EmptyStatement(&'a EmptyStatement)

§

ExpressionStatement(&'a ExpressionStatement<'a>)

§

IfStatement(&'a IfStatement<'a>)

§

DoWhileStatement(&'a DoWhileStatement<'a>)

§

WhileStatement(&'a WhileStatement<'a>)

§

ForStatement(&'a ForStatement<'a>)

§

ForInStatement(&'a ForInStatement<'a>)

§

ForOfStatement(&'a ForOfStatement<'a>)

§

ContinueStatement(&'a ContinueStatement<'a>)

§

BreakStatement(&'a BreakStatement<'a>)

§

ReturnStatement(&'a ReturnStatement<'a>)

§

WithStatement(&'a WithStatement<'a>)

§

SwitchStatement(&'a SwitchStatement<'a>)

§

SwitchCase(&'a SwitchCase<'a>)

§

LabeledStatement(&'a LabeledStatement<'a>)

§

ThrowStatement(&'a ThrowStatement<'a>)

§

TryStatement(&'a TryStatement<'a>)

§

CatchClause(&'a CatchClause<'a>)

§

CatchParameter(&'a CatchParameter<'a>)

§

DebuggerStatement(&'a DebuggerStatement)

§

AssignmentPattern(&'a AssignmentPattern<'a>)

§

ObjectPattern(&'a ObjectPattern<'a>)

§

BindingProperty(&'a BindingProperty<'a>)

§

ArrayPattern(&'a ArrayPattern<'a>)

§

BindingRestElement(&'a BindingRestElement<'a>)

§

Function(&'a Function<'a>)

§

FormalParameters(&'a FormalParameters<'a>)

§

FormalParameter(&'a FormalParameter<'a>)

§

FormalParameterRest(&'a FormalParameterRest<'a>)

§

FunctionBody(&'a FunctionBody<'a>)

§

ArrowFunctionExpression(&'a ArrowFunctionExpression<'a>)

§

YieldExpression(&'a YieldExpression<'a>)

§

Class(&'a Class<'a>)

§

ClassBody(&'a ClassBody<'a>)

§

MethodDefinition(&'a MethodDefinition<'a>)

§

PropertyDefinition(&'a PropertyDefinition<'a>)

§

PrivateIdentifier(&'a PrivateIdentifier<'a>)

§

StaticBlock(&'a StaticBlock<'a>)

§

AccessorProperty(&'a AccessorProperty<'a>)

§

ImportExpression(&'a ImportExpression<'a>)

§

ImportDeclaration(&'a ImportDeclaration<'a>)

§

ImportSpecifier(&'a ImportSpecifier<'a>)

§

ImportDefaultSpecifier(&'a ImportDefaultSpecifier<'a>)

§

ImportNamespaceSpecifier(&'a ImportNamespaceSpecifier<'a>)

§

WithClause(&'a WithClause<'a>)

§

ImportAttribute(&'a ImportAttribute<'a>)

§

ExportNamedDeclaration(&'a ExportNamedDeclaration<'a>)

§

ExportDefaultDeclaration(&'a ExportDefaultDeclaration<'a>)

§

ExportAllDeclaration(&'a ExportAllDeclaration<'a>)

§

ExportSpecifier(&'a ExportSpecifier<'a>)

§

V8IntrinsicExpression(&'a V8IntrinsicExpression<'a>)

§

BooleanLiteral(&'a BooleanLiteral)

§

NullLiteral(&'a NullLiteral)

§

NumericLiteral(&'a NumericLiteral<'a>)

§

StringLiteral(&'a StringLiteral<'a>)

§

BigIntLiteral(&'a BigIntLiteral<'a>)

§

RegExpLiteral(&'a RegExpLiteral<'a>)

§

JSXElement(&'a JSXElement<'a>)

§

JSXOpeningElement(&'a JSXOpeningElement<'a>)

§

JSXClosingElement(&'a JSXClosingElement<'a>)

§

JSXFragment(&'a JSXFragment<'a>)

§

JSXOpeningFragment(&'a JSXOpeningFragment)

§

JSXClosingFragment(&'a JSXClosingFragment)

§

JSXNamespacedName(&'a JSXNamespacedName<'a>)

§

JSXMemberExpression(&'a JSXMemberExpression<'a>)

§

JSXExpressionContainer(&'a JSXExpressionContainer<'a>)

§

JSXEmptyExpression(&'a JSXEmptyExpression)

§

JSXAttribute(&'a JSXAttribute<'a>)

§

JSXSpreadAttribute(&'a JSXSpreadAttribute<'a>)

§

JSXIdentifier(&'a JSXIdentifier<'a>)

§

JSXSpreadChild(&'a JSXSpreadChild<'a>)

§

JSXText(&'a JSXText<'a>)

§

TSThisParameter(&'a TSThisParameter<'a>)

§

TSEnumDeclaration(&'a TSEnumDeclaration<'a>)

§

TSEnumBody(&'a TSEnumBody<'a>)

§

TSEnumMember(&'a TSEnumMember<'a>)

§

TSTypeAnnotation(&'a TSTypeAnnotation<'a>)

§

TSLiteralType(&'a TSLiteralType<'a>)

§

TSConditionalType(&'a TSConditionalType<'a>)

§

TSUnionType(&'a TSUnionType<'a>)

§

TSIntersectionType(&'a TSIntersectionType<'a>)

§

TSParenthesizedType(&'a TSParenthesizedType<'a>)

§

TSTypeOperator(&'a TSTypeOperator<'a>)

§

TSArrayType(&'a TSArrayType<'a>)

§

TSIndexedAccessType(&'a TSIndexedAccessType<'a>)

§

TSTupleType(&'a TSTupleType<'a>)

§

TSNamedTupleMember(&'a TSNamedTupleMember<'a>)

§

TSOptionalType(&'a TSOptionalType<'a>)

§

TSRestType(&'a TSRestType<'a>)

§

TSAnyKeyword(&'a TSAnyKeyword)

§

TSStringKeyword(&'a TSStringKeyword)

§

TSBooleanKeyword(&'a TSBooleanKeyword)

§

TSNumberKeyword(&'a TSNumberKeyword)

§

TSNeverKeyword(&'a TSNeverKeyword)

§

TSIntrinsicKeyword(&'a TSIntrinsicKeyword)

§

TSUnknownKeyword(&'a TSUnknownKeyword)

§

TSNullKeyword(&'a TSNullKeyword)

§

TSUndefinedKeyword(&'a TSUndefinedKeyword)

§

TSVoidKeyword(&'a TSVoidKeyword)

§

TSSymbolKeyword(&'a TSSymbolKeyword)

§

TSThisType(&'a TSThisType)

§

TSObjectKeyword(&'a TSObjectKeyword)

§

TSBigIntKeyword(&'a TSBigIntKeyword)

§

TSTypeReference(&'a TSTypeReference<'a>)

§

TSQualifiedName(&'a TSQualifiedName<'a>)

§

TSTypeParameterInstantiation(&'a TSTypeParameterInstantiation<'a>)

§

TSTypeParameter(&'a TSTypeParameter<'a>)

§

TSTypeParameterDeclaration(&'a TSTypeParameterDeclaration<'a>)

§

TSTypeAliasDeclaration(&'a TSTypeAliasDeclaration<'a>)

§

TSClassImplements(&'a TSClassImplements<'a>)

§

TSInterfaceDeclaration(&'a TSInterfaceDeclaration<'a>)

§

TSInterfaceBody(&'a TSInterfaceBody<'a>)

§

TSPropertySignature(&'a TSPropertySignature<'a>)

§

TSIndexSignature(&'a TSIndexSignature<'a>)

§

TSCallSignatureDeclaration(&'a TSCallSignatureDeclaration<'a>)

§

TSMethodSignature(&'a TSMethodSignature<'a>)

§

TSConstructSignatureDeclaration(&'a TSConstructSignatureDeclaration<'a>)

§

TSIndexSignatureName(&'a TSIndexSignatureName<'a>)

§

TSInterfaceHeritage(&'a TSInterfaceHeritage<'a>)

§

TSTypePredicate(&'a TSTypePredicate<'a>)

§

TSModuleDeclaration(&'a TSModuleDeclaration<'a>)

§

TSGlobalDeclaration(&'a TSGlobalDeclaration<'a>)

§

TSModuleBlock(&'a TSModuleBlock<'a>)

§

TSTypeLiteral(&'a TSTypeLiteral<'a>)

§

TSInferType(&'a TSInferType<'a>)

§

TSTypeQuery(&'a TSTypeQuery<'a>)

§

TSImportType(&'a TSImportType<'a>)

§

TSImportTypeQualifiedName(&'a TSImportTypeQualifiedName<'a>)

§

TSFunctionType(&'a TSFunctionType<'a>)

§

TSConstructorType(&'a TSConstructorType<'a>)

§

TSMappedType(&'a TSMappedType<'a>)

§

TSTemplateLiteralType(&'a TSTemplateLiteralType<'a>)

§

TSAsExpression(&'a TSAsExpression<'a>)

§

TSSatisfiesExpression(&'a TSSatisfiesExpression<'a>)

§

TSTypeAssertion(&'a TSTypeAssertion<'a>)

§

TSImportEqualsDeclaration(&'a TSImportEqualsDeclaration<'a>)

§

TSExternalModuleReference(&'a TSExternalModuleReference<'a>)

§

TSNonNullExpression(&'a TSNonNullExpression<'a>)

§

Decorator(&'a Decorator<'a>)

§

TSExportAssignment(&'a TSExportAssignment<'a>)

§

TSNamespaceExportDeclaration(&'a TSNamespaceExportDeclaration<'a>)

§

TSInstantiationExpression(&'a TSInstantiationExpression<'a>)

§

JSDocNullableType(&'a JSDocNullableType<'a>)

§

JSDocNonNullableType(&'a JSDocNonNullableType<'a>)

§

JSDocUnknownType(&'a JSDocUnknownType)

Implementations§

Source§

impl<'a> AstKind<'a>

Source

pub fn is_statement(self) -> bool

Check if this AST node is a statement

Returns true for all statement types including iteration statements, control flow statements, and declaration statements.

Source

pub fn is_declaration(self) -> bool

Check if this AST node is a declaration

Returns true for function declarations, class declarations, variable declarations, TypeScript declarations, and module declarations.

Source

pub fn is_module_declaration(self) -> bool

Check if this AST node is a module declaration

Returns true for import/export declarations.

Source

pub fn as_module_declaration_kind(&self) -> Option<ModuleDeclarationKind<'a>>

Attempt to convert this AST node to a module declaration kind

Returns Some(ModuleDeclarationKind) if this is a module declaration, None otherwise.

Source

pub fn is_iteration_statement(self) -> bool

Check if this AST node is an iteration statement

Returns true for do-while, while, for-in, for-of, and for statements.

Source

pub fn is_identifier(self) -> bool

Check if this AST node is any kind of identifier

Returns true for binding identifiers, identifier references, and label identifiers.

Source

pub fn is_type(self) -> bool

Check if this AST node is a TypeScript type

Returns true for all TypeScript type nodes including keywords, type references, unions, intersections, etc.

Source

pub fn is_literal(self) -> bool

Check if this AST node is a literal

Returns true for numeric, string, boolean, null, bigint, regexp, and template literals.

Source

pub fn is_function_like(self) -> bool

Check if this AST node is function-like

Returns true for function expressions/declarations and arrow functions.

Source

pub fn has_argument_with_span(&self, span: Span) -> bool

Check if this CallExpression or NewExpression has an argument with the given span

This is useful for determining if a node is an argument to a call expression when traversing the AST, particularly after the removal of AstKind::Argument.

§Examples
// Check if a node is an argument to its parent call expression
if parent.has_argument_with_span(node.span()) {
    // This node is an argument
}
Source

pub fn is_callee_with_span(&self, span: Span) -> bool

Check if this CallExpression or NewExpression has the given span as its callee

This is useful for determining if a node is the callee of a call expression when traversing the AST.

§Examples
// Detect eval() calls
if let AstKind::IdentifierReference(ident) = node.kind() {
    if parent.is_callee_with_span(ident.span) && ident.name == "eval" {
        // This is an eval() call
    }
}
Source

pub fn identifier_name(self) -> Option<Ident<'a>>

Get the name of an identifier node

Returns the identifier name if this is any kind of identifier node, None otherwise.

Source

pub fn is_specific_id_reference(&self, name: &str) -> bool

Check if this is an identifier reference with a specific name

Returns true if this is an IdentifierReference with the given name.

Source

pub fn is_member_expression_kind(&self) -> bool

Returns whether this expression is a member expression, such as obj.prop, obj["prop"], or obj.#prop.

Source

pub fn as_member_expression_kind(&self) -> Option<MemberExpressionKind<'a>>

If this is some kind of member expression, returns it as a MemberExpressionKind. Otherwise, returns None.

Source

pub fn is_property_key(&self) -> bool

Check if this AST node is a property key

Returns true for identifier names and private identifiers used as property keys.

Source

pub fn as_property_key_kind(&self) -> Option<PropertyKeyKind<'a>>

Attempt to convert this AST node to a property key kind

Returns Some(PropertyKeyKind) if this is a property key, None otherwise.

Source

pub fn from_expression(e: &'a Expression<'a>) -> AstKind<'a>

Create an AstKind from an expression

Converts any expression type to its corresponding AstKind variant.

Source

pub fn ident_reference_is_assigned_to_in_parent( &self, parent: &AstKind<'a>, ) -> bool

Given an AstKind which is an IdentifierReference, and AstKind representing its parent node, returns true if the identifier is assigned to.

Note: parent must be the parent node of the identifier, and self must be an IdentifierReference. This method does not check those things, and may return incorrect results if either is not true.

Source§

impl AstKind<'_>

Source

pub fn debug_name(&self) -> Cow<'_, str>

Get the AST kind name with minimal details. Particularly useful for when debugging an iteration over an AST.

Note that this method does not exist in release builds. Do not include usage of this method within your code.

Source§

impl AstKind<'_>

Source

pub fn ty(&self) -> AstType

Get the AstType of an AstKind.

Source

pub fn node_id(&self) -> NodeId

Get NodeId of an AstKind.

Source

pub fn set_node_id(&self, node_id: NodeId)

Set NodeId of an AstKind.

Source§

impl<'a> AstKind<'a>

Source

pub fn as_program(self) -> Option<&'a Program<'a>>

Source

pub fn as_identifier_name(self) -> Option<&'a IdentifierName<'a>>

Source

pub fn as_identifier_reference(self) -> Option<&'a IdentifierReference<'a>>

Source

pub fn as_binding_identifier(self) -> Option<&'a BindingIdentifier<'a>>

Source

pub fn as_label_identifier(self) -> Option<&'a LabelIdentifier<'a>>

Source

pub fn as_this_expression(self) -> Option<&'a ThisExpression>

Source

pub fn as_array_expression(self) -> Option<&'a ArrayExpression<'a>>

Source

pub fn as_elision(self) -> Option<&'a Elision>

Source

pub fn as_object_expression(self) -> Option<&'a ObjectExpression<'a>>

Source

pub fn as_object_property(self) -> Option<&'a ObjectProperty<'a>>

Source

pub fn as_template_literal(self) -> Option<&'a TemplateLiteral<'a>>

Source

pub fn as_tagged_template_expression( self, ) -> Option<&'a TaggedTemplateExpression<'a>>

Source

pub fn as_template_element(self) -> Option<&'a TemplateElement<'a>>

Source

pub fn as_computed_member_expression( self, ) -> Option<&'a ComputedMemberExpression<'a>>

Source

pub fn as_static_member_expression( self, ) -> Option<&'a StaticMemberExpression<'a>>

Source

pub fn as_private_field_expression( self, ) -> Option<&'a PrivateFieldExpression<'a>>

Source

pub fn as_call_expression(self) -> Option<&'a CallExpression<'a>>

Source

pub fn as_new_expression(self) -> Option<&'a NewExpression<'a>>

Source

pub fn as_meta_property(self) -> Option<&'a MetaProperty<'a>>

Source

pub fn as_spread_element(self) -> Option<&'a SpreadElement<'a>>

Source

pub fn as_update_expression(self) -> Option<&'a UpdateExpression<'a>>

Source

pub fn as_unary_expression(self) -> Option<&'a UnaryExpression<'a>>

Source

pub fn as_binary_expression(self) -> Option<&'a BinaryExpression<'a>>

Source

pub fn as_private_in_expression(self) -> Option<&'a PrivateInExpression<'a>>

Source

pub fn as_logical_expression(self) -> Option<&'a LogicalExpression<'a>>

Source

pub fn as_conditional_expression(self) -> Option<&'a ConditionalExpression<'a>>

Source

pub fn as_assignment_expression(self) -> Option<&'a AssignmentExpression<'a>>

Source

pub fn as_array_assignment_target(self) -> Option<&'a ArrayAssignmentTarget<'a>>

Source

pub fn as_object_assignment_target( self, ) -> Option<&'a ObjectAssignmentTarget<'a>>

Source

pub fn as_assignment_target_rest(self) -> Option<&'a AssignmentTargetRest<'a>>

Source

pub fn as_assignment_target_with_default( self, ) -> Option<&'a AssignmentTargetWithDefault<'a>>

Source

pub fn as_assignment_target_property_identifier( self, ) -> Option<&'a AssignmentTargetPropertyIdentifier<'a>>

Source

pub fn as_assignment_target_property_property( self, ) -> Option<&'a AssignmentTargetPropertyProperty<'a>>

Source

pub fn as_sequence_expression(self) -> Option<&'a SequenceExpression<'a>>

Source

pub fn as_super(self) -> Option<&'a Super>

Source

pub fn as_await_expression(self) -> Option<&'a AwaitExpression<'a>>

Source

pub fn as_chain_expression(self) -> Option<&'a ChainExpression<'a>>

Source

pub fn as_parenthesized_expression( self, ) -> Option<&'a ParenthesizedExpression<'a>>

Source

pub fn as_directive(self) -> Option<&'a Directive<'a>>

Source

pub fn as_hashbang(self) -> Option<&'a Hashbang<'a>>

Source

pub fn as_block_statement(self) -> Option<&'a BlockStatement<'a>>

Source

pub fn as_variable_declaration(self) -> Option<&'a VariableDeclaration<'a>>

Source

pub fn as_variable_declarator(self) -> Option<&'a VariableDeclarator<'a>>

Source

pub fn as_empty_statement(self) -> Option<&'a EmptyStatement>

Source

pub fn as_expression_statement(self) -> Option<&'a ExpressionStatement<'a>>

Source

pub fn as_if_statement(self) -> Option<&'a IfStatement<'a>>

Source

pub fn as_do_while_statement(self) -> Option<&'a DoWhileStatement<'a>>

Source

pub fn as_while_statement(self) -> Option<&'a WhileStatement<'a>>

Source

pub fn as_for_statement(self) -> Option<&'a ForStatement<'a>>

Source

pub fn as_for_in_statement(self) -> Option<&'a ForInStatement<'a>>

Source

pub fn as_for_of_statement(self) -> Option<&'a ForOfStatement<'a>>

Source

pub fn as_continue_statement(self) -> Option<&'a ContinueStatement<'a>>

Source

pub fn as_break_statement(self) -> Option<&'a BreakStatement<'a>>

Source

pub fn as_return_statement(self) -> Option<&'a ReturnStatement<'a>>

Source

pub fn as_with_statement(self) -> Option<&'a WithStatement<'a>>

Source

pub fn as_switch_statement(self) -> Option<&'a SwitchStatement<'a>>

Source

pub fn as_switch_case(self) -> Option<&'a SwitchCase<'a>>

Source

pub fn as_labeled_statement(self) -> Option<&'a LabeledStatement<'a>>

Source

pub fn as_throw_statement(self) -> Option<&'a ThrowStatement<'a>>

Source

pub fn as_try_statement(self) -> Option<&'a TryStatement<'a>>

Source

pub fn as_catch_clause(self) -> Option<&'a CatchClause<'a>>

Source

pub fn as_catch_parameter(self) -> Option<&'a CatchParameter<'a>>

Source

pub fn as_debugger_statement(self) -> Option<&'a DebuggerStatement>

Source

pub fn as_assignment_pattern(self) -> Option<&'a AssignmentPattern<'a>>

Source

pub fn as_object_pattern(self) -> Option<&'a ObjectPattern<'a>>

Source

pub fn as_binding_property(self) -> Option<&'a BindingProperty<'a>>

Source

pub fn as_array_pattern(self) -> Option<&'a ArrayPattern<'a>>

Source

pub fn as_binding_rest_element(self) -> Option<&'a BindingRestElement<'a>>

Source

pub fn as_function(self) -> Option<&'a Function<'a>>

Source

pub fn as_formal_parameters(self) -> Option<&'a FormalParameters<'a>>

Source

pub fn as_formal_parameter(self) -> Option<&'a FormalParameter<'a>>

Source

pub fn as_formal_parameter_rest(self) -> Option<&'a FormalParameterRest<'a>>

Source

pub fn as_function_body(self) -> Option<&'a FunctionBody<'a>>

Source

pub fn as_arrow_function_expression( self, ) -> Option<&'a ArrowFunctionExpression<'a>>

Source

pub fn as_yield_expression(self) -> Option<&'a YieldExpression<'a>>

Source

pub fn as_class(self) -> Option<&'a Class<'a>>

Source

pub fn as_class_body(self) -> Option<&'a ClassBody<'a>>

Source

pub fn as_method_definition(self) -> Option<&'a MethodDefinition<'a>>

Source

pub fn as_property_definition(self) -> Option<&'a PropertyDefinition<'a>>

Source

pub fn as_private_identifier(self) -> Option<&'a PrivateIdentifier<'a>>

Source

pub fn as_static_block(self) -> Option<&'a StaticBlock<'a>>

Source

pub fn as_accessor_property(self) -> Option<&'a AccessorProperty<'a>>

Source

pub fn as_import_expression(self) -> Option<&'a ImportExpression<'a>>

Source

pub fn as_import_declaration(self) -> Option<&'a ImportDeclaration<'a>>

Source

pub fn as_import_specifier(self) -> Option<&'a ImportSpecifier<'a>>

Source

pub fn as_import_default_specifier( self, ) -> Option<&'a ImportDefaultSpecifier<'a>>

Source

pub fn as_import_namespace_specifier( self, ) -> Option<&'a ImportNamespaceSpecifier<'a>>

Source

pub fn as_with_clause(self) -> Option<&'a WithClause<'a>>

Source

pub fn as_import_attribute(self) -> Option<&'a ImportAttribute<'a>>

Source

pub fn as_export_named_declaration( self, ) -> Option<&'a ExportNamedDeclaration<'a>>

Source

pub fn as_export_default_declaration( self, ) -> Option<&'a ExportDefaultDeclaration<'a>>

Source

pub fn as_export_all_declaration(self) -> Option<&'a ExportAllDeclaration<'a>>

Source

pub fn as_export_specifier(self) -> Option<&'a ExportSpecifier<'a>>

Source

pub fn as_v8_intrinsic_expression(self) -> Option<&'a V8IntrinsicExpression<'a>>

Source

pub fn as_boolean_literal(self) -> Option<&'a BooleanLiteral>

Source

pub fn as_null_literal(self) -> Option<&'a NullLiteral>

Source

pub fn as_numeric_literal(self) -> Option<&'a NumericLiteral<'a>>

Source

pub fn as_string_literal(self) -> Option<&'a StringLiteral<'a>>

Source

pub fn as_big_int_literal(self) -> Option<&'a BigIntLiteral<'a>>

Source

pub fn as_reg_exp_literal(self) -> Option<&'a RegExpLiteral<'a>>

Source

pub fn as_jsx_element(self) -> Option<&'a JSXElement<'a>>

Source

pub fn as_jsx_opening_element(self) -> Option<&'a JSXOpeningElement<'a>>

Source

pub fn as_jsx_closing_element(self) -> Option<&'a JSXClosingElement<'a>>

Source

pub fn as_jsx_fragment(self) -> Option<&'a JSXFragment<'a>>

Source

pub fn as_jsx_opening_fragment(self) -> Option<&'a JSXOpeningFragment>

Source

pub fn as_jsx_closing_fragment(self) -> Option<&'a JSXClosingFragment>

Source

pub fn as_jsx_namespaced_name(self) -> Option<&'a JSXNamespacedName<'a>>

Source

pub fn as_jsx_member_expression(self) -> Option<&'a JSXMemberExpression<'a>>

Source

pub fn as_jsx_expression_container( self, ) -> Option<&'a JSXExpressionContainer<'a>>

Source

pub fn as_jsx_empty_expression(self) -> Option<&'a JSXEmptyExpression>

Source

pub fn as_jsx_attribute(self) -> Option<&'a JSXAttribute<'a>>

Source

pub fn as_jsx_spread_attribute(self) -> Option<&'a JSXSpreadAttribute<'a>>

Source

pub fn as_jsx_identifier(self) -> Option<&'a JSXIdentifier<'a>>

Source

pub fn as_jsx_spread_child(self) -> Option<&'a JSXSpreadChild<'a>>

Source

pub fn as_jsx_text(self) -> Option<&'a JSXText<'a>>

Source

pub fn as_ts_this_parameter(self) -> Option<&'a TSThisParameter<'a>>

Source

pub fn as_ts_enum_declaration(self) -> Option<&'a TSEnumDeclaration<'a>>

Source

pub fn as_ts_enum_body(self) -> Option<&'a TSEnumBody<'a>>

Source

pub fn as_ts_enum_member(self) -> Option<&'a TSEnumMember<'a>>

Source

pub fn as_ts_type_annotation(self) -> Option<&'a TSTypeAnnotation<'a>>

Source

pub fn as_ts_literal_type(self) -> Option<&'a TSLiteralType<'a>>

Source

pub fn as_ts_conditional_type(self) -> Option<&'a TSConditionalType<'a>>

Source

pub fn as_ts_union_type(self) -> Option<&'a TSUnionType<'a>>

Source

pub fn as_ts_intersection_type(self) -> Option<&'a TSIntersectionType<'a>>

Source

pub fn as_ts_parenthesized_type(self) -> Option<&'a TSParenthesizedType<'a>>

Source

pub fn as_ts_type_operator(self) -> Option<&'a TSTypeOperator<'a>>

Source

pub fn as_ts_array_type(self) -> Option<&'a TSArrayType<'a>>

Source

pub fn as_ts_indexed_access_type(self) -> Option<&'a TSIndexedAccessType<'a>>

Source

pub fn as_ts_tuple_type(self) -> Option<&'a TSTupleType<'a>>

Source

pub fn as_ts_named_tuple_member(self) -> Option<&'a TSNamedTupleMember<'a>>

Source

pub fn as_ts_optional_type(self) -> Option<&'a TSOptionalType<'a>>

Source

pub fn as_ts_rest_type(self) -> Option<&'a TSRestType<'a>>

Source

pub fn as_ts_any_keyword(self) -> Option<&'a TSAnyKeyword>

Source

pub fn as_ts_string_keyword(self) -> Option<&'a TSStringKeyword>

Source

pub fn as_ts_boolean_keyword(self) -> Option<&'a TSBooleanKeyword>

Source

pub fn as_ts_number_keyword(self) -> Option<&'a TSNumberKeyword>

Source

pub fn as_ts_never_keyword(self) -> Option<&'a TSNeverKeyword>

Source

pub fn as_ts_intrinsic_keyword(self) -> Option<&'a TSIntrinsicKeyword>

Source

pub fn as_ts_unknown_keyword(self) -> Option<&'a TSUnknownKeyword>

Source

pub fn as_ts_null_keyword(self) -> Option<&'a TSNullKeyword>

Source

pub fn as_ts_undefined_keyword(self) -> Option<&'a TSUndefinedKeyword>

Source

pub fn as_ts_void_keyword(self) -> Option<&'a TSVoidKeyword>

Source

pub fn as_ts_symbol_keyword(self) -> Option<&'a TSSymbolKeyword>

Source

pub fn as_ts_this_type(self) -> Option<&'a TSThisType>

Source

pub fn as_ts_object_keyword(self) -> Option<&'a TSObjectKeyword>

Source

pub fn as_ts_big_int_keyword(self) -> Option<&'a TSBigIntKeyword>

Source

pub fn as_ts_type_reference(self) -> Option<&'a TSTypeReference<'a>>

Source

pub fn as_ts_qualified_name(self) -> Option<&'a TSQualifiedName<'a>>

Source

pub fn as_ts_type_parameter_instantiation( self, ) -> Option<&'a TSTypeParameterInstantiation<'a>>

Source

pub fn as_ts_type_parameter(self) -> Option<&'a TSTypeParameter<'a>>

Source

pub fn as_ts_type_parameter_declaration( self, ) -> Option<&'a TSTypeParameterDeclaration<'a>>

Source

pub fn as_ts_type_alias_declaration( self, ) -> Option<&'a TSTypeAliasDeclaration<'a>>

Source

pub fn as_ts_class_implements(self) -> Option<&'a TSClassImplements<'a>>

Source

pub fn as_ts_interface_declaration( self, ) -> Option<&'a TSInterfaceDeclaration<'a>>

Source

pub fn as_ts_interface_body(self) -> Option<&'a TSInterfaceBody<'a>>

Source

pub fn as_ts_property_signature(self) -> Option<&'a TSPropertySignature<'a>>

Source

pub fn as_ts_index_signature(self) -> Option<&'a TSIndexSignature<'a>>

Source

pub fn as_ts_call_signature_declaration( self, ) -> Option<&'a TSCallSignatureDeclaration<'a>>

Source

pub fn as_ts_method_signature(self) -> Option<&'a TSMethodSignature<'a>>

Source

pub fn as_ts_construct_signature_declaration( self, ) -> Option<&'a TSConstructSignatureDeclaration<'a>>

Source

pub fn as_ts_index_signature_name(self) -> Option<&'a TSIndexSignatureName<'a>>

Source

pub fn as_ts_interface_heritage(self) -> Option<&'a TSInterfaceHeritage<'a>>

Source

pub fn as_ts_type_predicate(self) -> Option<&'a TSTypePredicate<'a>>

Source

pub fn as_ts_module_declaration(self) -> Option<&'a TSModuleDeclaration<'a>>

Source

pub fn as_ts_global_declaration(self) -> Option<&'a TSGlobalDeclaration<'a>>

Source

pub fn as_ts_module_block(self) -> Option<&'a TSModuleBlock<'a>>

Source

pub fn as_ts_type_literal(self) -> Option<&'a TSTypeLiteral<'a>>

Source

pub fn as_ts_infer_type(self) -> Option<&'a TSInferType<'a>>

Source

pub fn as_ts_type_query(self) -> Option<&'a TSTypeQuery<'a>>

Source

pub fn as_ts_import_type(self) -> Option<&'a TSImportType<'a>>

Source

pub fn as_ts_import_type_qualified_name( self, ) -> Option<&'a TSImportTypeQualifiedName<'a>>

Source

pub fn as_ts_function_type(self) -> Option<&'a TSFunctionType<'a>>

Source

pub fn as_ts_constructor_type(self) -> Option<&'a TSConstructorType<'a>>

Source

pub fn as_ts_mapped_type(self) -> Option<&'a TSMappedType<'a>>

Source

pub fn as_ts_template_literal_type( self, ) -> Option<&'a TSTemplateLiteralType<'a>>

Source

pub fn as_ts_as_expression(self) -> Option<&'a TSAsExpression<'a>>

Source

pub fn as_ts_satisfies_expression(self) -> Option<&'a TSSatisfiesExpression<'a>>

Source

pub fn as_ts_type_assertion(self) -> Option<&'a TSTypeAssertion<'a>>

Source

pub fn as_ts_import_equals_declaration( self, ) -> Option<&'a TSImportEqualsDeclaration<'a>>

Source

pub fn as_ts_external_module_reference( self, ) -> Option<&'a TSExternalModuleReference<'a>>

Source

pub fn as_ts_non_null_expression(self) -> Option<&'a TSNonNullExpression<'a>>

Source

pub fn as_decorator(self) -> Option<&'a Decorator<'a>>

Source

pub fn as_ts_export_assignment(self) -> Option<&'a TSExportAssignment<'a>>

Source

pub fn as_ts_namespace_export_declaration( self, ) -> Option<&'a TSNamespaceExportDeclaration<'a>>

Source

pub fn as_ts_instantiation_expression( self, ) -> Option<&'a TSInstantiationExpression<'a>>

Source

pub fn as_js_doc_nullable_type(self) -> Option<&'a JSDocNullableType<'a>>

Source

pub fn as_js_doc_non_nullable_type(self) -> Option<&'a JSDocNonNullableType<'a>>

Source

pub fn as_js_doc_unknown_type(self) -> Option<&'a JSDocUnknownType>

Trait Implementations§

Source§

impl<'a> Clone for AstKind<'a>

Source§

fn clone(&self) -> AstKind<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for AstKind<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl GetAddress for AstKind<'_>

Source§

fn address(&self) -> Address

Get Address of an AstKind.

Source§

impl GetSpan for AstKind<'_>

Source§

fn span(&self) -> Span

Get Span of an AstKind.

Source§

impl<'a> Copy for AstKind<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for AstKind<'a>

§

impl<'a> !RefUnwindSafe for AstKind<'a>

§

impl<'a> !Send for AstKind<'a>

§

impl<'a> !Sync for AstKind<'a>

§

impl<'a> Unpin for AstKind<'a>

§

impl<'a> UnsafeUnpin for AstKind<'a>

§

impl<'a> !UnwindSafe for AstKind<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsOut<T> for T
where T: Copy,

Source§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.