rust-typed-builder
rust-typed-builder copied to clipboard
Ensuring that at least one of a set of fields are set
It would be great if I could say something along the lines of:
#[derive(TypedBuilder)]
struct Foo {
#[group(a)]
#[default]
bar: Option<String>,
#[group(a)]
#[default]
baz: Option<String>,
#[default]
bat: Option<String>,
}
Made up the syntax, but basically some way to signal "one or both of bar/baz must be provided".