Enum erg_parser::ast::TypeSpec
source · [−]pub enum TypeSpec {
PreDeclTy(PreDeclTypeSpec),
Array(ArrayTypeSpec),
Tuple(Vec<TypeSpec>),
And(Box<TypeSpec>, Box<TypeSpec>),
Not(Box<TypeSpec>, Box<TypeSpec>),
Or(Box<TypeSpec>, Box<TypeSpec>),
Enum(ConstArgs),
Interval {
op: Token,
lhs: ConstExpr,
rhs: ConstExpr,
},
Subr(SubrTypeSpec),
TypeApp {
spec: Box<TypeSpec>,
args: TypeAppArgs,
},
}
Expand description
- Array:
[Int; 3]
,[Int, Ratio, Complex]
, etc. - Dict:
[Str: Str]
, etc. - And (Intersection type): Add and Sub and Mul (== Num), etc.
- Not (Diff type): Pos == Nat not {0}, etc.
- Or (Union type): Int or None (== Option Int), etc.
- Enum:
{0, 1}
(== Binary), etc. - Range: 1..12, 0.0<..1.0, etc.
- Record: {.into_s: Self.() -> Str }, etc.
- Subr: Int -> Int, Int => None, T.(X) -> Int, etc.
- TypeApp: F|…|
Variants
PreDeclTy(PreDeclTypeSpec)
Array(ArrayTypeSpec)
Tuple(Vec<TypeSpec>)
And(Box<TypeSpec>, Box<TypeSpec>)
Not(Box<TypeSpec>, Box<TypeSpec>)
Or(Box<TypeSpec>, Box<TypeSpec>)
Enum(ConstArgs)
Interval
Subr(SubrTypeSpec)
TypeApp
Implementations
sourceimpl TypeSpec
impl TypeSpec
pub fn and(lhs: TypeSpec, rhs: TypeSpec) -> Self
pub fn not(lhs: TypeSpec, rhs: TypeSpec) -> Self
pub fn or(lhs: TypeSpec, rhs: TypeSpec) -> Self
pub const fn interval(op: Token, lhs: ConstExpr, rhs: ConstExpr) -> Self
pub fn type_app(spec: TypeSpec, args: TypeAppArgs) -> Self
Trait Implementations
sourceimpl Locational for TypeSpec
impl Locational for TypeSpec
impl Eq for TypeSpec
impl StructuralEq for TypeSpec
impl StructuralPartialEq for TypeSpec
Auto Trait Implementations
impl RefUnwindSafe for TypeSpec
impl !Send for TypeSpec
impl !Sync for TypeSpec
impl Unpin for TypeSpec
impl UnwindSafe for TypeSpec
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more