Dynamic types
Dynamic types are types which can be defined and used solely within a Rune script. They provide the ability to structure data and associate functions with it.
The following is a quick example of a struct
:
struct Person {
name,
}
impl Person {
fn greet(self) {
println!("Greetings from {}, and good luck with this section!", self.name);
}
}
let person = Person { name: "John-John Tedro" };
person.greet();
$> cargo run -- run scripts/book/dynamic_types/greeting.rn
Greetings from John-John Tedro, and good luck with this section!