Files
100-exercises-to-learn-rust/book/src/03_ticket_v1/00_intro.md
LukeMathWalker 4401743807 Formatter
2024-05-24 18:16:20 +02:00

939 B
Raw Blame History

Modelling A Ticket

The first chapter should have given you a good grasp over some of Rusts primitive types, operators and basic control flow constructs.
In this chapter well go one step further and cover what makes Rust truly unique: ownership.
Ownership is what enables Rust to be both memory-safe and performant, with no garbage collector.

As our running example, well use a (JIRA-like) ticket, the kind youd use to track bugs, features, or tasks in a software project.
Well take a stab at modeling it in Rust. Itll be the first iteration—it wont be perfect nor very idiomatic by the end of the chapter. Itll be enough of a challenge though!
To move forward youll have to pick up several new Rust concepts, such as:

  • structs, one of Rusts ways to define custom types
  • Ownership, references and borrowing
  • Memory management: stack, heap, pointers, data layout, destructors
  • Modules and visibility
  • Strings