Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Types

This section is a work-in-progress experiment about making the book executable.

Syntax
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))

Type bool str ( ) Self & lifetime Lifetime m Mutability ty Type
#![allow(unused)]
fn main() {
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Type {
    Unit,
    Bool,
    Str,
    TraitSelf,
    Ref(Option<Lifetime>, Mutability, Box<Type>),
}
}