nested_structs/
nested_structs.rs

1use derive_wizard::Wizard;
2
3#[derive(Debug, Wizard)]
4#[allow(unused)]
5struct Address {
6    #[prompt("Street address:")]
7    street: String,
8
9    #[prompt("City:")]
10    city: String,
11
12    #[prompt("ZIP code:")]
13    zip: String,
14}
15
16#[derive(Debug, Wizard)]
17#[allow(unused)]
18struct ContactInfo {
19    #[prompt("Email:")]
20    email: String,
21
22    #[prompt("Phone:")]
23    phone: String,
24}
25
26#[derive(Debug, Wizard)]
27#[allow(unused)]
28struct User {
29    #[prompt("Full name:")]
30    name: String,
31
32    #[prompt("Age:")]
33    age: u32,
34
35    #[prompt("Address:")]
36    address: Address,
37
38    #[prompt("Contact:")]
39    contact: ContactInfo,
40}
41
42fn main() {
43    let user = User::wizard_builder().build().unwrap();
44    println!("{user:#?}");
45}