Ty

Enum Ty 

Source
pub enum Ty {
Show 34 variants Int(IntTy), Uint(UintTy), Float(FloatTy), Bool, Char, String, Ref { mutable: bool, inner: Box<Self>, }, Array { element: Box<Self>, size: u64, }, Slice { element: Box<Self>, }, Tuple(Vec<Self>), Function { params: Vec<Self>, return_ty: Box<Self>, }, Named { def_id: HirId, name: Symbol, }, Generic { def_id: HirId, name: Symbol, args: Vec<Self>, }, TypeParam { index: u32, name: Symbol, }, Unit, Never, Infer(InferTy), Error, TraitObject { trait_name: Symbol, }, Task { result_ty: Box<Self>, }, TaskGroup, Channel { element_ty: Box<Self>, }, Sender { element_ty: Box<Self>, }, Receiver { element_ty: Box<Self>, }, Future { result_ty: Box<Self>, }, Closure { id: HirId, params: Vec<Self>, return_ty: Box<Self>, capture_tys: Vec<Self>, }, Union { variants: Vec<Self>, }, Opaque { name: Symbol, def_id: HirId, }, NDArray { element: Box<Self>, rank: u32, }, NDView { element: Box<Self>, rank: u32, }, CowArray { element: Box<Self>, rank: u32, }, DynArray { element: Box<Self>, }, SmallVec { element: Box<Self>, capacity: u32, }, Simd { element: Box<Self>, lanes: u32, },
}
Expand description

Type representation in HIR

Variants§

§

Int(IntTy)

Integer types

§

Uint(UintTy)

Unsigned integer types

§

Float(FloatTy)

Float types

§

Bool

Boolean

§

Char

Character

§

String

String

§

Ref

Reference type (&T or &mut T)

Fields

§mutable: bool
§inner: Box<Self>
§

Array

Array type [T; N]

Fields

§element: Box<Self>
§size: u64
§

Slice

Slice type [T]

Fields

§element: Box<Self>
§

Tuple(Vec<Self>)

Tuple type (T, U, V)

§

Function

Function type

Fields

§params: Vec<Self>
§return_ty: Box<Self>
§

Named

Named type (structs, enums, etc.)

Fields

§def_id: HirId
§name: Symbol
§

Generic

Generic type instantiation (e.g., Vec, Option)

Fields

§def_id: HirId
§name: Symbol
§args: Vec<Self>
§

TypeParam

Type parameter reference (e.g., T in fn foo)

Fields

§index: u32
§name: Symbol
§

Unit

Unit type ()

§

Never

Never type !

§

Infer(InferTy)

Type variable (for inference)

§

Error

Error type (for error recovery)

§

TraitObject

Trait object type (dyn Trait)

Fields

§trait_name: Symbol
§

Task

Task handle - represents a spawned task that will produce a value

Fields

§result_ty: Box<Self>
§

TaskGroup

Task group handle - for structured concurrency

§

Channel

Channel - bidirectional communication channel

Fields

§element_ty: Box<Self>
§

Sender

Channel sender half

Fields

§element_ty: Box<Self>
§

Receiver

Channel receiver half

Fields

§element_ty: Box<Self>
§

Future

Future type (result of calling an async function)

Fields

§result_ty: Box<Self>
§

Closure

Closure type (captures + params → return)

Fields

§params: Vec<Self>
§return_ty: Box<Self>
§capture_tys: Vec<Self>
§

Union

Union type: i64 | f64 | String — tagged discriminated union

Fields

§variants: Vec<Self>
§

Opaque

Opaque type: zero-cost newtype with hidden underlying representation

Fields

§name: Symbol
§def_id: HirId
§

NDArray

Owned N-dimensional array: NDArray[T; N] — heap-allocated contiguous data

Fields

§element: Box<Self>
§rank: u32
§

NDView

Borrowed N-dimensional view: NDView[T; N] — zero-copy slice into an NDArray

Fields

§element: Box<Self>
§rank: u32
§

CowArray

Copy-on-write array: CowArray[T; N] — shared data, cloned on mutation

Fields

§element: Box<Self>
§rank: u32
§

DynArray

Dynamic-rank array: DynArray[T] — rank determined at runtime

Fields

§element: Box<Self>
§

SmallVec

Small vector with inline storage: SmallVec[T; N]

Fields

§element: Box<Self>
§capacity: u32
§

Simd

SIMD vector type: Simd[T; N]

Fields

§element: Box<Self>
§lanes: u32

Implementations§

Source§

impl Ty

Source

pub const fn is_int(&self) -> bool

Check if this type is an integer type

Source

pub const fn is_float(&self) -> bool

Check if this type is a float type

Source

pub fn is_numeric(&self) -> bool

Check if this type is numeric

Source

pub fn is_copy(&self) -> bool

Check if this type is copyable

Source

pub const fn default_value(&self) -> Option<Literal>

Get the default value for this type (for uninitialized variables)

Trait Implementations§

Source§

impl Clone for Ty

Source§

fn clone(&self) -> Ty

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ty

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Ty

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Ty

Source§

fn eq(&self, other: &Ty) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Ty

Source§

impl StructuralPartialEq for Ty

Auto Trait Implementations§

§

impl Freeze for Ty

§

impl RefUnwindSafe for Ty

§

impl Send for Ty

§

impl Sync for Ty

§

impl Unpin for Ty

§

impl UnwindSafe for Ty

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.