#[derive(Debug)]
struct Person{
name: String,
age: i8,
}
fn main() {
let mut persons = Vec::new();
persons.push(Person{
name: String::from("Test"),
age: 22
});
persons.push(Person{
name: String::from("Doom"),
age: 45
});
println!("Vector of persons: {:#?}", persons);
}
Output:
Vector of persons: [
Person {
name: "Test",
age: 22,
},
Person {
name: "Doom",
age: 45,
},
]
The result is what is expected. Beyond that I've no idea what you're asking.
Yes, it's fine.
If you have only these two, you can use vec![Person{…}, Person{…}].
If you have more, and know how many, you can optimize it a bit by replacing Vec::new() with Vec::with_capacity(number_of_items_you_will_push).
Good use of String in Person. Conversion from borrowed &str is the right choice here, because structs typically own their data.
I'm new so i was trying to do something that i already did in Go, so i was worry that it was not well implemented.
Thank you a lot for your answer. 
i was just worry of a bad implementation.