use buildstructor::buildstructor; pub struct Foo { simple: T, } #[buildstructor] impl Foo { #[builder] fn new(simple: T) -> Foo { Self { simple } } #[builder] fn bound2_new(simple: T) -> Foo where T: std::fmt::Debug, { Self { simple } } } #[buildstructor] impl Foo { #[builder] fn bound1_new(simple: T) -> Foo { Self { simple } } } #[buildstructor] impl Foo { #[builder] fn bound3_new(simple: usize) -> Foo { Self { simple } } #[builder] fn bound4_new(simple: usize) -> Self { Self { simple } } } fn main() { let _ = Foo::builder().simple(3).build(); let _ = Foo::bound1_builder().simple(3).build(); let _ = Foo::bound2_builder().simple(3).build(); let _ = Foo::bound3_builder().simple(3).build(); let _ = Foo::bound4_builder().simple(3).build(); }