Types#
Rust is statically typed with a small set of primitives, two
composite forms (struct and enum), references, slices,
strings, and a generic type system with traits. The compiler
infers locally; the operator annotates at function boundaries.
For the literal forms, see Syntax. For traits, see OOP.
Pages#
i* / u* / f*, bool, char, (), !.
String and &str; bytes vs chars.
Anonymous fixed-size, mixed-type records.
[T; N], &[T], Vec<T>.
&T, &mut T, Option<&T> for nullable.
Named, tuple, and unit forms; struct update.
Discriminated unions; variants carry data.
Null replacement; exception replacement; ? operator.
<T> type parameters, trait bounds, where clauses.
'a region annotations; 'static.
&dyn Trait, Box<dyn Trait>; vtable dispatch.
type Name = ... vs newtype structs.
as; From / Into; TryFrom / TryInto.
References#
Syntax for the literal forms.
Operators for
as,?, and arithmetic semantics.OOP for structs, enums, traits,
implblocks.Errors for
OptionandResultin depth.