pub enum Type {
Int,
Float,
Bool,
String,
Bytes,
Unit,
List {
elem: Box<Type>,
},
Tuple {
elems: Vec<Type>,
},
Record {
fields: Vec<RecordField>,
},
Sum {
variants: Vec<Variant>,
},
Fun {
params: Vec<Type>,
ret: Box<Type>,
},
Var {
name: String,
},
}Expand description
Static type attached to a subtree via AlephTree::Typed, or to a
TypeDef’s variant fields. Deliberately small: enough to type-check
records, sum types, and function signatures (see the Aleph-Next spec)
without committing yet to full parametric polymorphism.
Variants§
Int
64-bit signed integer.
Float
64-bit floating point number.
Bool
Boolean.
String
UTF-8 text.
Bytes
Raw byte sequence.
Unit
The single-valued “nothing” type.
#[default] here exists only so AlephTree’s strum::EnumString
derive can build a placeholder Type value for its FromStr path
(which requires every struct-like variant’s fields to implement
Default). It is not a sentinel for “no type annotation” — use
Option<Type> for that. Don’t let Type::default() leak into
real type-checking logic.
List
Homogeneous list of elem.
Tuple
Fixed-size heterogeneous tuple.
Record
Named-field record (struct).
Fields
fields: Vec<RecordField>Sum
Tagged union of named variants (sum/enum type).
Fun
Function signature: positional parameter types and a return type.
Var
A type variable, referenced by name (for as-yet-unresolved/generic types).