#[non_exhaustive]
pub enum TypeInfo {
Show 16 variants Array { braces: ContainedSpan, type_info: Box<TypeInfo>, }, Basic(TokenReference), String(TokenReference), Boolean(TokenReference), Callback { generics: Option<GenericDeclaration>, parentheses: ContainedSpan, arguments: Punctuated<TypeArgument>, arrow: TokenReference, return_type: Box<TypeInfo>, }, Generic { base: TokenReference, arrows: ContainedSpan, generics: Punctuated<TypeInfo>, }, GenericPack { name: TokenReference, ellipse: TokenReference, }, Intersection { left: Box<TypeInfo>, ampersand: TokenReference, right: Box<TypeInfo>, }, Module { module: TokenReference, punctuation: TokenReference, type_info: Box<IndexedTypeInfo>, }, Optional { base: Box<TypeInfo>, question_mark: TokenReference, }, Table { braces: ContainedSpan, fields: Punctuated<TypeField>, }, Typeof { typeof_token: TokenReference, parentheses: ContainedSpan, inner: Box<Expression>, }, Tuple { parentheses: ContainedSpan, types: Punctuated<TypeInfo>, }, Union { left: Box<TypeInfo>, pipe: TokenReference, right: Box<TypeInfo>, }, Variadic { ellipse: TokenReference, type_info: Box<TypeInfo>, }, VariadicPack { ellipse: TokenReference, name: TokenReference, },
}
Expand description

Any type, such as string, boolean?, number | boolean, etc.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Array

Fields

braces: ContainedSpan

The braces ({}) containing the type info.

type_info: Box<TypeInfo>

The type info for the values in the Array

A shorthand type annotating the structure of an array: { number }

Basic(TokenReference)

A standalone type, such as string or Foo.

String(TokenReference)

A singleton string type, such as "hello"

Boolean(TokenReference)

A singleton boolean type, such as true

Callback

Fields

generics: Option<GenericDeclaration>

Optional generics provided for the arguments, such as in <T>(T) -> string

parentheses: ContainedSpan

The parentheses for the arguments.

arguments: Punctuated<TypeArgument>

The argument types: (string, number).

arrow: TokenReference

The “thin arrow” (->) in between the arguments and the return type.

return_type: Box<TypeInfo>

The return type: boolean.

A callback type, such as (string, number) => boolean.

Generic

Fields

base: TokenReference

The type that has generics: map.

arrows: ContainedSpan

The arrows (<>) containing the type parameters.

generics: Punctuated<TypeInfo>

The type parameters: number, string.

A type using generics, such as map<number, string>.

GenericPack

Fields

name: TokenReference

The name of the type that is generic: T.

ellipse: TokenReference

The ellipse: ....

A generic pack: T.... Note, these are only available as return types, when annotating a vararg (...) in a function parameter, or as a generic type argument.

Intersection

Fields

left: Box<TypeInfo>

The left hand side: string.

ampersand: TokenReference

The ampersand (&) to separate the types.

right: Box<TypeInfo>

The right hand side: number.

An intersection type: string & number, denoting both types.

Module

Fields

module: TokenReference

The module the type is coming from: module.

punctuation: TokenReference

The punctuation (.) to index the module.

type_info: Box<IndexedTypeInfo>

The indexed type info: Foo.

A type coming from a module, such as module.Foo

Optional

Fields

base: Box<TypeInfo>

The type that is optional: string.

question_mark: TokenReference

The question mark: ?.

An optional type, such as string?.

Table

Fields

braces: ContainedSpan

The braces ({}) containing the fields.

fields: Punctuated<TypeField>

The fields: foo: number, bar: string.

A type annotating the structure of a table: { foo: number, bar: string }

Typeof

Fields

typeof_token: TokenReference

The token typeof.

parentheses: ContainedSpan

The parentheses used to contain the expression.

inner: Box<Expression>

The inner expression: foo.

A type in the form of typeof(foo).

Tuple

Fields

parentheses: ContainedSpan

The parentheses used to contain the types

types: Punctuated<TypeInfo>

The types: (string, number).

A tuple expression: (string, number).

Union

Fields

left: Box<TypeInfo>

The left hand side: string.

pipe: TokenReference

The pipe (|) to separate the types.

right: Box<TypeInfo>

The right hand side: number.

A union type: string | number, denoting one or the other.

Variadic

Fields

ellipse: TokenReference

The ellipse: ....

type_info: Box<TypeInfo>

The type that is variadic: number.

A variadic type: ...number.

VariadicPack

Fields

ellipse: TokenReference

The ellipse: ...

name: TokenReference

The name of the type that is variadic: T

A variadic type pack: ...T in Function<...T>

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

The start position of a node. None if can’t be determined

The end position of a node. None if it can’t be determined

Whether another node of the same type is the same as this one semantically, ignoring position

The token references that comprise a node

The full range of a node, if it has both start and end positions

The tokens surrounding a node that are ignored and not accessible through the node’s own accessors. Use this if you want to get surrounding comments or whitespace. Returns a tuple of the leading and trailing trivia. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.