pub enum TypeKind {
VoidType,
TimeType,
IntType(usize),
EnumType(usize),
PointerType(Type),
SignalType(Type),
ArrayType(usize, Type),
StructType(Vec<Type>),
FuncType(Vec<Type>, Type),
EntityType(Vec<Type>, Vec<Type>),
}
Expand description
The different kinds of types.
Variants§
VoidType
The void
type.
TimeType
The time
type.
IntType(usize)
Integer types like i32
.
EnumType(usize)
Enumerated types like n42
.
PointerType(Type)
Pointer types like i32*
.
SignalType(Type)
Signal types like i32$
.
ArrayType(usize, Type)
Array types like [4 x i32]
.
StructType(Vec<Type>)
Struct types like {i8, i32}
.
FuncType(Vec<Type>, Type)
Function types like (i32) void
.
EntityType(Vec<Type>, Vec<Type>)
Entity types like (i8, i8; i32)
.
Implementations§
Source§impl TypeKind
impl TypeKind
Sourcepub fn unwrap_int(&self) -> usize
pub fn unwrap_int(&self) -> usize
Unwrap the type to its integer bit width, or panic if the type is not an integer.
Sourcepub fn unwrap_enum(&self) -> usize
pub fn unwrap_enum(&self) -> usize
Unwrap the type to its number of enumerated states, or panic if the type is not an enum.
Sourcepub fn unwrap_pointer(&self) -> &Type
pub fn unwrap_pointer(&self) -> &Type
Unwrap the type to its pointer data type, or panic if the type is not a
pointer. E.g. yields the i8
type in i8*
.
Sourcepub fn unwrap_signal(&self) -> &Type
pub fn unwrap_signal(&self) -> &Type
Unwrap the type to its signal data type, or panic if the type is not an
integer. E.g. yields the i8
type in i8$
.
Sourcepub fn unwrap_array(&self) -> (usize, &Type)
pub fn unwrap_array(&self) -> (usize, &Type)
Unwrap the type to its array length and element type, or panic if the
type is not an array. E.g. yields the (16, i32)
in [16 x i32]
.
Sourcepub fn unwrap_struct(&self) -> &[Type] ⓘ
pub fn unwrap_struct(&self) -> &[Type] ⓘ
Unwrap the type to its struct fields, or panic if the type is not a
struct. E.g. yields the [i8, i16]
in {i8, i16}
.
Sourcepub fn unwrap_func(&self) -> (&[Type], &Type)
pub fn unwrap_func(&self) -> (&[Type], &Type)
Unwrap the type into arguments and return type, or panic if the type is not a function.
Sourcepub fn unwrap_entity(&self) -> (&[Type], &[Type])
pub fn unwrap_entity(&self) -> (&[Type], &[Type])
Unwrap the type into input and output arguments, or panic if the type is not an entity.
Sourcepub fn is_pointer(&self) -> bool
pub fn is_pointer(&self) -> bool
Check if this is a pointer type.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TypeKind
impl<'de> Deserialize<'de> for TypeKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for TypeKind
impl Ord for TypeKind
Source§impl PartialOrd for TypeKind
impl PartialOrd 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 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more