Enum debris_llir::class::ClassKind
source · pub enum ClassKind {
Type(Type),
Struct(StructRef),
StructValue(StructRef),
Tuple(TupleRef),
TupleValue(TupleRef),
Function(FunctionClassRef),
}
Expand description
An enum over every type that exists in debris.
Either a simple Type
or a complex type with additional data.
Most complex types come in two variants: As a pattern and as a value. A pattern could be e.g. a struct which may be required in a function definition as parameter. The value would then be the struct object that can actually be passed to that function.
Variants§
Type(Type)
Struct(StructRef)
StructValue(StructRef)
Tuple(TupleRef)
TupleValue(TupleRef)
Function(FunctionClassRef)
Implementations§
source§impl ClassKind
impl ClassKind
sourcepub fn matches(&self, other: &ClassKind) -> bool
pub fn matches(&self, other: &ClassKind) -> bool
Returns whether the other class kind matches this class kind if this is interpreted as a pattern. For example, a struct object can match on a struct, if the underlying struct is equal.
sourcepub fn diverges(&self) -> bool
pub fn diverges(&self) -> bool
Returns whether this value diverges, aka is impossible to construct. A diverging class can match on any pattern.
This is also used for some optimizations
sourcepub fn runtime_encodable(&self) -> bool
pub fn runtime_encodable(&self) -> bool
Returns whether this type can be fully encoded at runtime.
sourcepub fn comptime_encodable(&self) -> bool
pub fn comptime_encodable(&self) -> bool
Returns whether this type can be fully encoded at compile time.
Trait Implementations§
source§impl PartialEq for ClassKind
impl PartialEq for ClassKind
impl Eq for ClassKind
impl StructuralEq for ClassKind
impl StructuralPartialEq for ClassKind
Auto Trait Implementations§
impl !RefUnwindSafe for ClassKind
impl !Send for ClassKind
impl !Sync for ClassKind
impl Unpin for ClassKind
impl !UnwindSafe for ClassKind
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.