Enum debris_llir::types::Type
source · pub enum Type {
Show 17 variants
Any,
Null,
Never,
ComptimeInt,
DynamicInt,
ComptimeBool,
DynamicBool,
String,
FormatString,
Function,
FunctionRef,
Type,
Module,
Struct,
StructObject,
Tuple,
TupleObject,
}
Expand description
The type of a class object
Variants§
Any
Type which matches with every other type Objects of type any should not exist.
Null
The null type, implicitly returned by functions which don’t specify a return type, also the value that statements return (since everything is an expression)
Never
Marks a value that cannot be constructed, for example
The return value of loop {}
ComptimeInt
Compile time known 32-bit signed integer
DynamicInt
32-bit signed integer known at runtime
ComptimeBool
A boolean value known at compile time
DynamicBool
Runtime boolean
String
A compile time known string
FormatString
A compile time known format string
Function
Any function, native or api
FunctionRef
A reference to a compiled function A compiled function is uniquely identified by its block id Basically a function after monomorphization
Type
The type of a type
Module
Module type
Struct
Type of a struct definition
StructObject
An instantiated struct
Tuple
Type of a tuple
TODO: Could a Type::Tuple
not just be a Type::TupleObject
with types as elements?
TupleObject
An instantiated tuple
Implementations§
source§impl Type
impl Type
pub fn is_int(&self) -> bool
pub fn is_never(&self) -> bool
pub fn diverges(&self) -> bool
sourcepub fn runtime_encodable(&self) -> bool
pub fn runtime_encodable(&self) -> bool
Returns whether this type can be completely encoded at runtime
sourcepub fn comptime_encodable(&self) -> bool
pub fn comptime_encodable(&self) -> bool
Returns whether this type can be encoded at compile time.
sourcepub fn is_reference(&self) -> bool
pub fn is_reference(&self) -> bool
Returns whether this type should be treated as a reference. This effects e.g. whether variables get copied when assigned or passed to functions TODO: implement some proper reference object, to make this less implicit and confusing. Right now, only structs are treated as references
Trait Implementations§
source§impl PartialEq for Type
impl PartialEq for Type
impl Copy for Type
impl Eq for Type
impl StructuralEq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.