Enum full_moon::ast::types::TypeInfo[][src]

#[non_exhaustive]
pub enum TypeInfo {
    Array {
        braces: ContainedSpan,
        type_info: Box<TypeInfo>,
    },
    Basic(TokenReference),
    Callback {
        parentheses: ContainedSpan,
        arguments: Punctuated<TypeArgument>,
        arrow: TokenReference,
        return_type: Box<TypeInfo>,
    },
    Generic {
        base: TokenReference,
        arrows: ContainedSpan,
        generics: Punctuated<TypeInfo>,
    },
    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>,
    },
}
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

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

Fields of Array

braces: ContainedSpan

The braces ({}) containing the type info.

type_info: Box<TypeInfo>

The type info for the values in the Array

Basic

A standalone type, such as string or Foo.

Tuple Fields of Basic

0: TokenReference
Callback

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

Fields of Callback

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.

Generic

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

Fields of Generic

base: TokenReference

The type that has generics: map.

arrows: ContainedSpan

The arrows (<>) containing the type parameters.

generics: Punctuated<TypeInfo>

The type parameters: number, string.

Intersection

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

Fields of Intersection

left: Box<TypeInfo>

The left hand side: string.

ampersand: TokenReference

The ampersand (&) to separate the types.

right: Box<TypeInfo>

The right hand side: number.

Module

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

Fields of Module

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.

Optional

An optional type, such as string?.

Fields of Optional

base: Box<TypeInfo>

The type that is optional: string.

question_mark: TokenReference

The question mark: ?.

Table

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

Fields of Table

braces: ContainedSpan

The braces ({}) containing the fields.

fields: Punctuated<TypeField>

The fields: foo: number, bar: string.

Typeof

A type in the form of typeof(foo).

Fields of Typeof

typeof_token: TokenReference

The token typeof.

parentheses: ContainedSpan

The parentheses used to contain the expression.

inner: Box<Expression>

The inner expression: foo.

Tuple

A tuple expression: (string, number).

Fields of Tuple

parentheses: ContainedSpan

The parentheses used to contain the types

types: Punctuated<TypeInfo>

The types: (string, number).

Union

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

Fields of Union

left: Box<TypeInfo>

The left hand side: string.

pipe: TokenReference

The pipe (|) to separate the types.

right: Box<TypeInfo>

The right hand side: number.

Variadic

A variadic type: ...number.

Fields of Variadic

ellipse: TokenReference

The ellipse: ....

type_info: Box<TypeInfo>

The type that is variadic: number.

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)

recently added

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.