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

source

pub fn is_int(&self) -> bool

source

pub fn is_never(&self) -> bool

source

pub fn diverges(&self) -> bool

source

pub fn runtime_encodable(&self) -> bool

Returns whether this type can be completely encoded at runtime

source

pub fn comptime_encodable(&self) -> bool

Returns whether this type can be encoded at compile time.

source

pub fn matches(&self, other: Type) -> bool

Returns whether other matches the pattern of self

source

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 Clone for Type

source§

fn clone(&self) -> Type

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Type

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Type

Error messages can safely use the debug impl for display

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Type> for ClassKind

source§

fn from(value: Type) -> Self

Converts to this type from the input type.
source§

impl Hash for Type

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Type

source§

fn eq(&self, other: &Type) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Type

source§

impl Eq for Type

source§

impl StructuralEq for Type

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.