Wyzer

Everything we call real is made of things that cannot be regarded as real.

— Niels Bohr

Structs

NAME wyzer-structs - Custom data structures

DESCRIPTION Structs are compound types that group multiple typed fields under a single identifier.

SYNOPSIS: DEFINITION AND INSTANTIATION

struct User {
    id: u32,
    username: str,
    is_active: bool,
}

fn main() {
    var user1 = User {
        id: 101,
        username: "alice",
        is_active: false,
    };

    user1.is_active = true; 
}

STRUCT DETAILS

  • struct: Keyword to define the layout of the fields.
  • Instantiation: Provide values for all fields in braces { ... }.
  • Field Access: Use dot notation (user1.is_active). Requires var binding to mutate.

© 2026 Wyzer Contributors

Edit this page on GitHub