Skip to content

Consider new public/private declaration format to account for restricted visibility #96

@TedDriggs

Description

@TedDriggs

With restricted visibility stabilizing in 1.18 (see rust-lang/rust#32409), it would be good for derive_builder to support declaring restricted visibility for the generated structs, setters, and fields.

Proposal

#[derive(Builder)]
#[builder(vis = "pub(crate)")]
pub(crate) struct Foo {
    bar: u8
}

This would also be available in the setter, field, and build_fn sub-options. We could keep the current #[builder(public)] option for compatibility, but I think it probably makes sense to deprecate it since the method above is more future-proof (and easier to validate that it only appears once).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions