Beyond The Basics

In this section, we are going to conver,

  • Vectors, written as Vec.
    • A vector is kind of a re-sizable array but all elements must be in the same type.
    • ⭐️ It’s a generic type, written as Vec . T can have any type, ex. The type of a Vec of i32s is Vec. Also, Vectors always allocate their data in a dynamically allocated heap.
    • let v: Vec = Vec::new(); will create a new empty Vector.
    • Vectors are implemented using generics, Vec type provided by the standard library can hold any type, and when a specific vector holds a specific type, the type is specified within angle brackets.
    • using vec! macro, let v = vec![1, 2, 3];, this will create a new Vec
  • Structs
  • Enums
  • Generics
  • Impls ans Traits