Enum TypeKind
pub enum TypeKind {
Show 46 variants
I8,
I16,
I32,
I64,
U8,
U16,
U32,
U64,
Isize,
Usize,
F16,
F32,
F64,
Bool,
Char,
Unit,
CSchar,
CShort,
CInt,
CLong,
CLonglong,
CUchar,
CUshort,
CUint,
CUlong,
CUlonglong,
CFloat,
CDouble,
CVoid,
Struct(StructId),
Enum(EnumId),
Interface(InterfaceId),
Array(ArrayTypeId),
PtrConst(PtrConstTypeId),
PtrMut(PtrMutTypeId),
Ref(RefTypeId),
MutRef(MutRefTypeId),
Slice(SliceTypeId),
MutSlice(MutSliceTypeId),
Vec(VecTypeId),
Module(ModuleId),
Error,
Never,
ComptimeType,
ComptimeStr,
ComptimeInt,
}Expand description
The kind of a type - used for pattern matching.
This enum mirrors the structure of the Type enum but is designed for
pattern matching. During the migration to Type(InternedType), code that
pattern matches on types will use ty.kind() to get a TypeKind.
This separation allows incremental migration: all pattern matches can be
updated to use .kind() while Type is still an enum, then Type can be
replaced with Type(InternedType) without breaking existing code.
Variants§
I8
8-bit signed integer
I16
16-bit signed integer
I32
32-bit signed integer
I64
64-bit signed integer
U8
8-bit unsigned integer
U16
16-bit unsigned integer
U32
32-bit unsigned integer
U64
64-bit unsigned integer
Isize
Pointer-sized signed integer
Usize
Pointer-sized unsigned integer
F16
IEEE 754 binary16 (half-precision float)
F32
IEEE 754 binary32 (single-precision float)
F64
IEEE 754 binary64 (double-precision float)
Bool
Boolean
Char
Unicode scalar value (ADR-0071)
Unit
The unit type (for functions that don’t return a value)
CSchar
ADR-0086: C signed char — target-resolved (8-bit signed on every blessed target).
CShort
ADR-0086: C short — target-resolved (16-bit signed on every blessed target).
CInt
ADR-0086: C int — target-resolved (32-bit signed on every blessed target).
Canonical discriminant type for @mark(c) enum.
CLong
ADR-0086: C long — target-resolved (64-bit signed on every blessed LP64 target;
32-bit on hypothetical LLP64 targets like Windows).
CLonglong
ADR-0086: C long long — target-resolved (64-bit signed on every blessed target).
CUchar
ADR-0086: C unsigned char — target-resolved (8-bit unsigned on every blessed target).
CUshort
ADR-0086: C unsigned short — target-resolved (16-bit unsigned on every blessed target).
CUint
ADR-0086: C unsigned int — target-resolved (32-bit unsigned on every blessed target).
CUlong
ADR-0086: C unsigned long — target-resolved (64-bit unsigned on every blessed LP64 target).
CUlonglong
ADR-0086: C unsigned long long — target-resolved (64-bit unsigned on every blessed target).
CFloat
ADR-0086: C float — IEEE 754 binary32 on every blessed target.
CDouble
ADR-0086: C double — IEEE 754 binary64 on every blessed target.
CVoid
ADR-0086: C void — incomplete type. No values, no size, no alignment.
Only usable through Ptr(c_void) / MutPtr(c_void). Cannot appear in
value-bearing positions (let, return, parameter by value, struct/enum field
by value). Use () (unit) for C void return types.
Struct(StructId)
User-defined struct type
Enum(EnumId)
User-defined enum type
Interface(InterfaceId)
User-defined interface type (ADR-0056). Used both as the bound on a
comptime T: I parameter and (Phase 4) as a runtime type behind a
borrowing parameter.
Array(ArrayTypeId)
Fixed-size array type: [T; N]
PtrConst(PtrConstTypeId)
Raw pointer to immutable data: ptr const T
PtrMut(PtrMutTypeId)
Raw pointer to mutable data: ptr mut T
Ref(RefTypeId)
Immutable reference (ADR-0062): Ref(T) — scope-bound, exclusivity-checked.
MutRef(MutRefTypeId)
Mutable reference (ADR-0062): MutRef(T) — scope-bound, exclusive.
Slice(SliceTypeId)
Immutable slice (ADR-0064): Slice(T) — scope-bound fat pointer {ptr, len}.
MutSlice(MutSliceTypeId)
Mutable slice (ADR-0064): MutSlice(T) — scope-bound exclusive fat pointer.
Vec(VecTypeId)
Owned, growable vector (ADR-0066): Vec(T) — heap-allocated {ptr, len, cap}.
Module(ModuleId)
A module type (from @import)
Error
An error type (used during type checking to continue after errors)
Never
The never type - represents computations that don’t return
ComptimeType
The comptime type - the type of types themselves
ComptimeStr
The comptime string type - compile-time only string values
ComptimeInt
The comptime integer type - compile-time only integer values
Trait Implementations§
§impl<'de> Deserialize<'de> for TypeKind
impl<'de> Deserialize<'de> for TypeKind
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TypeKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TypeKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for TypeKind
impl Serialize for TypeKind
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for TypeKind
impl Eq for TypeKind
impl StructuralPartialEq for TypeKind
Auto Trait Implementations§
impl Freeze for TypeKind
impl RefUnwindSafe for TypeKind
impl Send for TypeKind
impl Sync for TypeKind
impl Unpin for TypeKind
impl UnsafeUnpin for TypeKind
impl UnwindSafe for TypeKind
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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].