File: multiple_builders.rs

package info (click to toggle)
rust-buildstructor 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 532 kB
  • sloc: makefile: 2
file content (29 lines) | stat: -rw-r--r-- 448 bytes parent folder | download
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
use buildstructor::buildstructor;
pub struct Foo1 {
    simple: usize,
}

pub struct Foo2 {
    simple: usize,
}

#[buildstructor]
impl Foo1 {
    #[builder]
    fn new(simple: usize) -> Foo1 {
        Self { simple }
    }
}

#[buildstructor]
impl Foo2 {
    #[builder]
    fn new(simple: usize) -> Foo2 {
        Self { simple }
    }
}

fn main() {
    let _ = Foo1::builder().simple(3).build();
    let _ = Foo2::builder().simple(3).build();
}