Enum mun_hir::TyKind

source ·
pub enum TyKind {
    Struct(Struct),
    Float(FloatTy),
    Int(IntTy),
    Bool,
    Tuple(usizeSubstitution),
    InferenceVar(InferTy),
    TypeAlias(TypeAlias),
    Never,
    FnDef(CallableDefSubstitution),
    Array(Ty),
    Unknown,
}
Expand description

A kind of type.

Variants§

§

Struct(Struct)

An abstract datatype (structures, tuples, or enumerations) TODO: Add enumerations

§

Float(FloatTy)

The primitive floating point type. Written as float.

§

Int(IntTy)

The primitive integral type. Written as int.

§

Bool

The primitive boolean type. Written as bool.

§

Tuple(usizeSubstitution)

A tuple type. For example (f32, f64, bool).

§

InferenceVar(InferTy)

A type variable used during type checking. Not to be confused with a type parameter.

§

TypeAlias(TypeAlias)

A type alias

§

Never

The never type never.

§

FnDef(CallableDefSubstitution)

The anonymous type of a function declaration/definition. Each function has a unique type, which is output (for a function named foo returning an number) as fn() -> number {foo}.

This includes tuple struct / enum variant constructors as well.

For example the type of bar here:

function foo() -> number { 1 }
let bar = foo; // bar: function() -> number {foo}
§

Array(Ty)

An dynamically sized array type

§

Unknown

A placeholder for a type which could not be computed; this is propagated to avoid useless error messages. Doubles as a placeholder where type variables are inserted before type checking, since we want to try to infer a better type here anyway – for the IDE use case, we want to try to infer as much as possible even in the presence of type errors.

Implementations§

Constructs a new Ty by interning self

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
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. 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.