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)
Array
Array type [T; N]
Slice
Slice type [T]
Tuple(Vec<Self>)
Tuple type (T, U, V)
Function
Function type
Named
Named type (structs, enums, etc.)
Generic
Generic type instantiation (e.g., Vec
TypeParam
Type parameter reference (e.g., T in fn foo
Unit
Unit type ()
Never
Never type !
Infer(InferTy)
Type variable (for inference)
Error
Error type (for error recovery)
TraitObject
Trait object type (dyn Trait)
Task
Task handle - represents a spawned task that will produce a value
TaskGroup
Task group handle - for structured concurrency
Channel
Channel - bidirectional communication channel
Sender
Channel sender half
Receiver
Channel receiver half
Future
Future type (result of calling an async function)
Closure
Closure type (captures + params → return)
Union
Union type: i64 | f64 | String — tagged discriminated union
Opaque
Opaque type: zero-cost newtype with hidden underlying representation
NDArray
Owned N-dimensional array: NDArray[T; N] — heap-allocated contiguous data
NDView
Borrowed N-dimensional view: NDView[T; N] — zero-copy slice into an NDArray
CowArray
Copy-on-write array: CowArray[T; N] — shared data, cloned on mutation
DynArray
Dynamic-rank array: DynArray[T] — rank determined at runtime
SmallVec
Small vector with inline storage: SmallVec[T; N]
Simd
SIMD vector type: Simd[T; N]
Implementations§
Source§impl Ty
impl Ty
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check if this type is numeric
Sourcepub const fn default_value(&self) -> Option<Literal>
pub const fn default_value(&self) -> Option<Literal>
Get the default value for this type (for uninitialized variables)
Trait Implementations§
impl Eq for Ty
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.