blob: 2b423c7c70497f9d0ca959e1d62ad0f7853c186f (
plain)
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
|
#[macro_use]
extern crate pretty_assertions;
#[macro_use]
extern crate derive_builder;
#[derive(Debug, PartialEq, Default, Builder, Clone)]
#[builder(setter(prefix = "with"))]
struct Lorem {
ipsum: &'static str,
#[builder(setter(prefix = "set"))]
pub dolor: &'static str,
}
#[test]
fn prefixed_setters() {
let x = LoremBuilder::default()
.with_ipsum("ipsum")
.set_dolor("dolor")
.build()
.unwrap();
assert_eq!(
x,
Lorem {
ipsum: "ipsum",
dolor: "dolor",
}
);
}
|