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
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
A standalone type, such as string
or Foo
.
Tuple Fields of Basic
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
.
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
.
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
.
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
.
An optional type, such as string?
.
Fields of Optional
base: Box<TypeInfo>
The type that is optional: string
.
question_mark: TokenReference
The question mark: ?
.
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
.
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
.
A tuple expression: (string, number)
.
Fields of Tuple
parentheses: ContainedSpan
The parentheses used to contain the types
types: Punctuated<TypeInfo>
The types: (string, number)
.
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
.
A variadic type: ...number
.
Fields of Variadic
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. 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
Auto Trait Implementations
impl RefUnwindSafe for TypeInfo
impl UnwindSafe for TypeInfo
Blanket Implementations
Mutably borrows from an owned value. Read more