Types
The Mist type system including references, pointers, tuples, function types, and trait objects.
Type System
i32 // Path type
str& // Reference type
i32 mut& // Mutable reference
i32 'a& // Reference with lifetime
i32 unsafe& // Const pointer
i32 mut unsafe& // Mutable pointer
(i32, bool) // Tuple type
i32[]& // Array type (static non-fixed size)
i32[10] // Array type (fixed size)
bool fn(i32) // Function pointer type
bool Fn(i32) // Closure trait (Fn)
bool FnMut(i32) // Closure trait (FnMut)
bool FnOnce(i32) // Closure trait (FnOnce)
dyn Trait // Trait object
void // Unit type (maps to Rust's ())
'lifetime // LifetimeType expressions can be composed:
type_expr = { (void | path_type | tuple_type | dyn_type) ~ (unsafe_ref_type | ref_type | fn_type)* }This means types are written left-to-right naturally:
i32& // &i32
i32 mut& // &mut i32
i32 'a& // &'a i32
bool fn(i32) // fn(i32) -> boolType Aliases
type MyInt = i32;
type Result<T> = std::result::Result<T, str&>;