pub enum Type {
Primitive(PrimitiveType),
Named {
name: String,
args: Vec<Type>,
},
Function {
params: Vec<Type>,
ret: Box<Type>,
},
Var(TypeVarId),
Array(Box<Type>),
Tuple(Vec<Type>),
}Expand description
A type in Husk’s core type language.
Variants§
Primitive(PrimitiveType)
A primitive type such as i32, bool, String, or ().
Named
A named, possibly generic type such as Option<T> or Result<T, E>.
Fields
Function
A function type: (T1, T2, ...) -> R.
Var(TypeVarId)
A type variable introduced during type checking.
Array(Box<Type>)
An array type: [T].
Tuple(Vec<Type>)
A tuple type: (T1, T2, ...).
Implementations§
Source§impl Type
impl Type
pub fn i32() -> Self
pub fn i64() -> Self
pub fn f64() -> Self
pub fn bool() -> Self
pub fn string() -> Self
pub fn unit() -> Self
pub fn named(name: impl Into<String>, args: Vec<Type>) -> Self
pub fn function(params: Vec<Type>, ret: Type) -> Self
pub fn tuple(elements: Vec<Type>) -> Self
Trait Implementations§
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more