-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.rs
More file actions
40 lines (28 loc) · 915 Bytes
/
main.rs
File metadata and controls
40 lines (28 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
mod email_address;
mod user;
use std::error::Error;
use fortifier::Validate;
use crate::{email_address::ChangeEmailAddressRelation, user::CreateUser};
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let data = CreateUser {
email: "john@doe.com".to_owned(),
name: "John Doe".to_owned(),
url: "https://john.doe.com".to_owned(),
country_code: "GB".to_owned(),
locales: vec!["en_GB".to_owned()],
};
data.validate().await?;
let data = ChangeEmailAddressRelation::Create {
email_address: "john@doe.com".to_owned(),
};
data.validate().await?;
let data = ChangeEmailAddressRelation::Update {
id: "1".to_owned(),
email_address: "john@doe.com".to_owned(),
};
data.validate().await?;
let data = ChangeEmailAddressRelation::Delete { id: "1".to_owned() };
data.validate().await?;
Ok(())
}