Structs

Structs are custom data types that you can define that can hold multiple values of different types that are related to each other. Think of structs like classes in Java, but with a few key differences.

Here's an example of a struct in Rust:

struct User {
  id: i32,
  username: String,
  email: String,
}

In this lesson we're going to learn about structs and the different types of structs including tuple structs, unit structs, and structs with named fields. We'll also learn how to define structs, use structs, different ways to create instances of structs, and how to define implementations for structs.

Rustfinity.com

Links

  1. Home
  2. Learn Rust
  3. Get Started
  4. Practice Rust
  5. Challenges
  6. Open source

Socials

  1. GitHub
  2. X

Legal

  1. Privacy Policy
  2. Terms of Service