idanarye/rust-typed-builder

[Feature request] `strip_bool` allows setting fields to `true` without arguments

Closed this issue · 0 comments

Suppose we have a struct:

#[derive(Clone, Eq, PartialEq, Hash, Debug, Default)]
pub struct Style {
    color: Option<Color>,
    bg_color: Option<Color>,
    bold: bool,
    faint: bool,
    italic: bool,
    underline: bool,
    slow_blink: bool,
    rapid_blink: bool,
    invert: bool,
    conceal: bool,
    strikethrough: bool,
    reset: bool,
}

Can we add a strip_bool to make

Style::builder().bold().faint().italic().underline().build()

possible instead of writing

Style::builder().bold(true).faint(true).italic(true).underline(true).build()

?