Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting build_fn-specific pattern #327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion derive_builder_core/src/macro_options/darling_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ pub struct BuildFn {
skip: bool,
name: Ident,
validate: Option<Path>,
pattern: Option<BuilderPattern>,
#[darling(flatten)]
visibility: VisibilityAttr,
/// Either the path to an existing error type that the build method should return or a meta
Expand Down Expand Up @@ -189,6 +190,7 @@ impl Default for BuildFn {
BuildFn {
skip: false,
name: Ident::new("build", Span::call_site()),
pattern: None,
validate: None,
visibility: Default::default(),
error: None,
Expand Down Expand Up @@ -701,7 +703,7 @@ impl Options {
enabled: !self.build_fn.skip,
ident: &self.build_fn.name,
visibility: self.build_method_vis(),
pattern: self.pattern,
pattern: self.build_fn.pattern.unwrap_or(self.pattern),
target_ty: &self.ident,
target_ty_generics: Some(ty_generics),
error_ty: self.builder_error_ident(),
Expand Down