Rust and Cargo 1 · Code patterns

Define a struct

Define a type and derive common traits for debugging, copying and comparing.

#[derive(Debug, Clone, PartialEq)]
struct User {
    name: String,
    age: u32,
}

Official Rust and Cargo 1 documentation

More code patterns commands

All code patterns commands · Rust and Cargo 1 cheatsheet

Was this page helpful?