toasty_driver_integration_suite/scenarios/
person_contact_deferred_metadata.rs1use crate::prelude::*;
2
3scenario! {
4 #![id(ID)]
5
6 #[derive(Debug, toasty::Model)]
7 struct Person {
8 #[key]
9 #[auto]
10 id: ID,
11
12 name: String,
13
14 contact: ContactInfo,
15 }
16
17 #[derive(Debug, toasty::Embed)]
18 enum ContactInfo {
19 Email { address: String, metadata: Metadata },
20 Phone { number: String },
21 }
22
23 #[derive(Debug, toasty::Embed)]
24 struct Metadata {
25 author: String,
26 notes: toasty::Deferred<String>,
27 }
28
29 async fn setup(test: &mut Test) -> toasty::Db {
30 test.setup_db(models!(Person)).await
31 }
32}