Skip to content

Commit e5aafe5

Browse files
committed
code refactoring changes with properties added to mapped fields
1 parent e00f6f6 commit e5aafe5

9 files changed

+1079
-1081
lines changed

Cargo.lock

+52
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/dto_example.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::str::FromStr;
66
use unstringify::unstringify;
77

88
fn concat_str(s1: &str, s2: &str) -> String {
9-
s1.to_owned() + " " + s2
9+
s1.to_owned() + " " + s2
1010
}
1111

1212
#[derive(DtoMapper, Debug, Default, Clone)]
@@ -17,23 +17,23 @@ fn concat_str(s1: &str, s2: &str) -> String {
1717
new_fields=[( "name: String", "concat_str( self.firstname.as_str(), self.lastname.as_str() )" )]
1818
)]
1919
struct User {
20-
username: String,
21-
password: String,
22-
email: String,
23-
firstname: String,
24-
middle_name: Option<String>,
25-
lastname: String,
26-
age: u8,
20+
username: String,
21+
password: String,
22+
email: String,
23+
firstname: String,
24+
middle_name: Option<String>,
25+
lastname: String,
26+
age: u8,
2727
}
2828

2929
fn main() {
30-
let user = User {
31-
firstname: "Dessalines".into(),
32-
lastname: "Jean Jacques".into(),
33-
..User::default()
34-
};
30+
let user = User {
31+
firstname: "Dessalines".into(),
32+
lastname: "Jean Jacques".into(),
33+
..User::default()
34+
};
3535

36-
println!("{:?}", user);
37-
let custom_dto: CustomDto = user.into();
38-
println!("{:?}", custom_dto);
36+
println!("{:?}", user);
37+
let custom_dto: CustomDto = user.into();
38+
println!("{:?}", custom_dto);
3939
}

0 commit comments

Comments
 (0)