Types
This section is a work-in-progress experiment about making the book executable.
Syntax
Type:
| bool =>
| str =>
| ( ) =>
| Self =>
| & lifetime=Lifetime? m=Mutability ty=Type =>
| bool =>
Type::Bool| str =>
Type::Str| ( ) =>
Type::Unit| Self =>
Type::TraitSelf| & lifetime=Lifetime? m=Mutability ty=Type =>
Type::Ref(lifetime, m, Box::new(ty))
#![allow(unused)] fn main() { #[derive(Debug, Clone, PartialEq, Eq)] pub enum Type { Unit, Bool, Str, TraitSelf, Ref(Option<Lifetime>, Mutability, Box<Type>), } }