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

#[non_exhaustive]pub enum TypeInfo<'a> {
    Array {
        braces: ContainedSpan<'a>,
        type_info: Box<TypeInfo<'a>>,
    },
    Basic(TokenReference<'a>),
    Callback {
        parentheses: ContainedSpan<'a>,
        arguments: Punctuated<'a, TypeInfo<'a>>,
        arrow: TokenReference<'a>,
        return_type: Box<TypeInfo<'a>>,
    },
    Generic {
        base: TokenReference<'a>,
        arrows: ContainedSpan<'a>,
        generics: Punctuated<'a, TypeInfo<'a>>,
    },
    Intersection {
        left: Box<TypeInfo<'a>>,
        ampersand: TokenReference<'a>,
        right: Box<TypeInfo<'a>>,
    },
    Module {
        module: TokenReference<'a>,
        punctuation: TokenReference<'a>,
        type_info: Box<IndexedTypeInfo<'a>>,
    },
    Optional {
        base: Box<TypeInfo<'a>>,
        question_mark: TokenReference<'a>,
    },
    Table {
        braces: ContainedSpan<'a>,
        fields: Punctuated<'a, TypeField<'a>>,
    },
    Typeof {
        typeof_token: TokenReference<'a>,
        parentheses: ContainedSpan<'a>,
        inner: Box<Expression<'a>>,
    },
    Tuple {
        parentheses: ContainedSpan<'a>,
        types: Punctuated<'a, TypeInfo<'a>>,
    },
    Union {
        left: Box<TypeInfo<'a>>,
        pipe: TokenReference<'a>,
        right: Box<TypeInfo<'a>>,
    },
}

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

Variants (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<'a>

The braces ({}) containing the type info.

type_info: Box<TypeInfo<'a>>

The type info for the values in the Array

Basic(TokenReference<'a>)

A standalone type, such as string or Foo.

Callback

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

Fields of Callback

parentheses: ContainedSpan<'a>

The parentheses for the arguments.

arguments: Punctuated<'a, TypeInfo<'a>>

The argument types: (string, number).

arrow: TokenReference<'a>

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

return_type: Box<TypeInfo<'a>>

The return type: boolean.

Generic

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

Fields of Generic

base: TokenReference<'a>

The type that has generics: map.

arrows: ContainedSpan<'a>

The arrows (<>) containing the type parameters.

generics: Punctuated<'a, TypeInfo<'a>>

The type parameters: number, string.

Intersection

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

Fields of Intersection

left: Box<TypeInfo<'a>>

The left hand side: string.

ampersand: TokenReference<'a>

The ampersand (&) to separate the types.

right: Box<TypeInfo<'a>>

The right hand side: number.

Module

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

Fields of Module

module: TokenReference<'a>

The module the type is coming from: module.

punctuation: TokenReference<'a>

The punctuation (.) to index the module.

type_info: Box<IndexedTypeInfo<'a>>

The indexed type info: Foo.

Optional

An optional type, such as string?.

Fields of Optional

base: Box<TypeInfo<'a>>

The type that is optional: string.

question_mark: TokenReference<'a>

The question mark: ?.

Table

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

Fields of Table

braces: ContainedSpan<'a>

The braces ({}) containing the fields.

fields: Punctuated<'a, TypeField<'a>>

The fields: foo: number, bar: string.

Typeof

A type in the form of typeof(foo).

Fields of Typeof

typeof_token: TokenReference<'a>

The token typeof.

parentheses: ContainedSpan<'a>

The parentheses used to contain the expression.

inner: Box<Expression<'a>>

The inner expression: foo.

Tuple

A tuple expression: (string, number).

Fields of Tuple

parentheses: ContainedSpan<'a>

The parentheses used to contain the types

types: Punctuated<'a, TypeInfo<'a>>

The types: (string, number).

Union

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

Fields of Union

left: Box<TypeInfo<'a>>

The left hand side: string.

pipe: TokenReference<'a>

The pipe (|) to separate the types.

right: Box<TypeInfo<'a>>

The right hand side: number.

Trait Implementations

impl<'a> Clone for TypeInfo<'a>[src]

impl<'a> Debug for TypeInfo<'a>[src]

impl<'de: 'a, 'a> Deserialize<'de> for TypeInfo<'a>[src]

impl<'a> Display for TypeInfo<'a>[src]

impl<'a> Node<'a> for TypeInfo<'a>[src]

impl<'a> Owned for TypeInfo<'a>[src]

type Owned = TypeInfo<'static>

What an owned version of the object looks like. Usually contains a 'static lifetime.

impl<'a> PartialEq<TypeInfo<'a>> for TypeInfo<'a>[src]

impl<'a> Serialize for TypeInfo<'a>[src]

impl<'a> StructuralPartialEq for TypeInfo<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for TypeInfo<'a>

impl<'a> Send for TypeInfo<'a>

impl<'a> Sync for TypeInfo<'a>

impl<'a> Unpin for TypeInfo<'a>

impl<'a> UnwindSafe for TypeInfo<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.