pub enum PrimitiveType {
I32,
I64,
U32,
U64,
F32,
F64,
Bool,
String,
UnspecifiedInt,
UnspecifiedFloat,
Unit,
Unknown,
}
Expand description
Represents all primitive types in the language
Variants§
I32
32-bit signed integer
I64
64-bit signed integer
U32
32-bit unsigned integer
U64
64-bit unsigned integer
F32
32-bit floating point
F64
64-bit floating point
Bool
Boolean type
String
String type
UnspecifiedInt
Unspecified integer type (for literals)
UnspecifiedFloat
Unspecified float type (for literals)
Unit
Unit type (similar to Rust’s ())
Unknown
Unknown type
Implementations§
Source§impl PrimitiveType
impl PrimitiveType
Source§impl PrimitiveType
impl PrimitiveType
pub fn iter() -> impl Iterator<Item = PrimitiveType> + Clone
Source§impl PrimitiveType
impl PrimitiveType
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check if this is a numeric type (integer or float)
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Check if this is an integer type
Sourcepub fn is_signed_integer(&self) -> bool
pub fn is_signed_integer(&self) -> bool
Check if this is a signed integer type
Sourcepub fn is_unsigned_integer(&self) -> bool
pub fn is_unsigned_integer(&self) -> bool
Check if this is an unsigned integer type
Sourcepub fn to_type_kind(&self) -> TypeKind
pub fn to_type_kind(&self) -> TypeKind
Get the TypeKind for this primitive type
This method defines the actual type characteristics for each primitive type, separating type definition from type registration logic.
Trait Implementations§
Source§impl Clone for PrimitiveType
impl Clone for PrimitiveType
Source§fn clone(&self) -> PrimitiveType
fn clone(&self) -> PrimitiveType
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PrimitiveType
impl Debug for PrimitiveType
Source§impl From<PrimitiveType> for TypeId
impl From<PrimitiveType> for TypeId
Source§fn from(primitive: PrimitiveType) -> Self
fn from(primitive: PrimitiveType) -> Self
Converts to this type from the input type.
Source§impl From<PrimitiveType> for usize
impl From<PrimitiveType> for usize
Source§fn from(primitive: PrimitiveType) -> usize
fn from(primitive: PrimitiveType) -> usize
Converts to this type from the input type.
Source§impl Hash for PrimitiveType
impl Hash for PrimitiveType
Source§impl PartialEq for PrimitiveType
impl PartialEq for PrimitiveType
impl Copy for PrimitiveType
impl Eq for PrimitiveType
impl StructuralPartialEq for PrimitiveType
Auto Trait Implementations§
impl Freeze for PrimitiveType
impl RefUnwindSafe for PrimitiveType
impl Send for PrimitiveType
impl Sync for PrimitiveType
impl Unpin for PrimitiveType
impl UnwindSafe for PrimitiveType
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
Mutably borrows from an owned value. Read more