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

Define the types in the tuple

  • Optionally we can define the types of elements of a tuple.
  • This can be useful if we don't want the default types. (e.g the default integer type is i32, but here we use i8.)
fn main() {
    let things: (i8, char, String) = (11, '2', String::from("three"));
    println!("{:?}", things);
}
(11, '2', "three")