Skip to content

Commit e3d1dcb

Browse files
committed
feat: v2.0.12
1 parent 1818952 commit e3d1dcb

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lombok-macros"
3-
version = "2.0.11"
3+
version = "2.0.12"
44
readme = "README.md"
55
edition = "2024"
66
authors = ["root@ltpp.vip"]

debug/src/main.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ struct LombokTest<'a, T: Clone + Debug> {
1313
#[get_mut(pub(crate))]
1414
#[set(private)]
1515
name: String,
16+
#[get_mut(pub(crate))]
17+
#[set(private)]
18+
user: User,
1619
}
1720

18-
#[derive(CustomDebug, Getter, New)]
21+
#[derive(CustomDebug, Clone, Getter, Setter, New)]
1922
struct User {
23+
#[set(type(AsRef<str>))]
2024
name: String,
2125
#[debug(skip)]
2226
_password: String,
@@ -200,10 +204,15 @@ fn main() {
200204
opt_value: None,
201205
result_value: Err("error"),
202206
name: "test".to_string(),
207+
user: User {
208+
name: "Alice".to_string(),
209+
_password: "secret123".to_string(),
210+
email: Some("alice@ltpp.vip".to_string()),
211+
},
203212
};
204-
let name: &mut String = data.get_mut_name();
205-
*name = "mut".to_string();
206-
assert_eq!(data.get_name(), "mut");
213+
let user: &mut User = data.get_mut_user();
214+
user.set_name("Bob");
215+
assert_eq!(data.get_user().get_name(), "Bob");
207216
let list: Vec<String> = vec!["hello".to_string(), "world".to_string()];
208217
data.set_list(list.clone());
209218
assert_eq!(*data.get_list(), list);

0 commit comments

Comments
 (0)