use buildstructor::buildstructor; use std::error::Error; pub struct Fallible { simple: usize, } #[buildstructor] impl Fallible { #[builder] fn new(simple: usize) -> Result> { Ok(Self { simple }) } } fn main() { let fallible = Fallible::builder().simple(2).build().unwrap(); assert_eq!(fallible.simple, 2); }