Structs
Custom types with named fields.
struct
Define the shape then create a value with fields.
fn main() {
let p = { hp: 100, score: 0 }
print(p.hp)
}fn main() -> void {
let p = { hp: 100, score: 0 }
print(p.hp)
}Output
100
Fast · Safe · Minimal
Custom types with named fields.
Define the shape then create a value with fields.
fn main() {
let p = { hp: 100, score: 0 }
print(p.hp)
}fn main() -> void {
let p = { hp: 100, score: 0 }
print(p.hp)
}Output
100