pub enum TypeExpr {
Primitive {
kind: PrimType,
span: Span,
},
Named {
name: String,
span: Span,
},
Array {
elem: Box<TypeExpr>,
size: u64,
span: Span,
},
DynArray {
elem: Box<TypeExpr>,
span: Span,
},
Tuple {
elems: Vec<TypeExpr>,
span: Span,
},
Fn {
params: Vec<TypeExpr>,
ret: Box<TypeExpr>,
span: Span,
},
Generic {
name: String,
args: Vec<TypeExpr>,
span: Span,
},
}Expand description
a type as written in source: a primitive name, a named type, a fixed or
dynamic array, a tuple, a function type, or a generic application. type
expressions appear in parameter and return positions, struct fields, enum
variant data, and let x: T = ....
Variants§
Primitive
a primitive type name: i64, f64, bool, str, byte, void.
Named
a named type – a struct, enum, or interface name (the parser does not distinguish; Phase 3 resolves it).
Array
[ elem; size ] – a fixed-size array. size is the literal length.
DynArray
[ elem ] – a dynamic array.
Tuple
( T1, T2, ... ) – a tuple type.
Fn
fn( T1, T2 ) -> T3 – a function type.
Generic
Name< T1, T2 > – a generic application (used by Result<T, E> and
Option<T>). the parser allows it on any name; restricting which names
may be generic is Phase 3’s job.
Implementations§
Trait Implementations§
impl StructuralPartialEq for TypeExpr
Auto Trait Implementations§
impl Freeze for TypeExpr
impl RefUnwindSafe for TypeExpr
impl Send for TypeExpr
impl Sync for TypeExpr
impl Unpin for TypeExpr
impl UnsafeUnpin for TypeExpr
impl UnwindSafe for TypeExpr
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