blob: 9bd5e9299f1b29b44d82656b007930cd2ef099d8 [file] [log] [blame]
// Structs, Borrowing
#![allow(dead_code)]
use rust_tutorial::*;
fn greet_person(p: &Person) {
println!("Hello {} ({})!", p.name, p.age);
}
fn main() {
// -- Struct instantiation --
let p = Person {
age: 30,
name: "Mary".to_string(),
};
// -- Borrowing --
greet_person(&p);
greet_person(&p);
}