O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

item

Top-level definitions are called items. These include functions, use declarations, type definitions, and so on. Here are some examples:

  • use std::io;
  • fn main() { println!("hello") }
  • const X: usize = 8;

These do not have to be one-liners, of course. The main function would be a single item, even if it spanned several lines.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required