Struct mun_hir::Ty

source ·
pub struct Ty(_);
Expand description

External representation of a type. This should be cheap to clone.

Implementations§

Returns the TyKind from which this instance was constructed

Returns a mutable reference of TyKind for this instance

Convert this instance back to the TyKind that created it.

Constructs an instance of the unit type ()

Constructs a new struct type

If this type represents a struct type, returns the type of the struct.

If this type represents a tuple type, returns a reference to the substitutions of the tuple.

If this type represents an array type, returns a reference to the element type.

Returns true if this type represents the empty tuple type

Returns true if this type represents the never type

Returns the callable definition for the given expression or None if the type does not represent a callable.

Returns the callable signature of the type, if the type is callable.

Returns the type’s name as a string, if one exists.

This name needs to be unique as it is used to generate a type’s Guid.

Returns true if this instance represents a known type.

Returns true if this instance is of an unknown type.

Returns the type parameters of this type if it has some (i.e. is an ADT or function); so if self is an Option<u32>, this returns the u32

Returns a mutable reference to the type parameters of this type if it has some (i.e. is an ADT or function); so if self is an Option<u32>, this returns the u32

Returns true if the other type has the same type constructor

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
Creates a value from an iterator. 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.