Structs and Implementations
Structs define custom data types, and impl blocks add methods.
Defining a Struct
#![allow(unused)] fn main() { struct Person { pub age: Felt, male: bool, } }
Implementing Methods
#![allow(unused)] fn main() { impl Person { pub fn get_age(self: Person) -> Felt { return self.age; } } }
Usage
fn main() -> Felt { let p: Person = new Person { age: 20, male: true }; p.get_age() }