Debian Codegraph @

src/macro_options/darling_opts.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::IntoIterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/IntoIter#};
3
4 use craterust-analyzer cargo derive_builder_core 0.20.2 crate/::BuildMethodrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#;
5
6 use darlingrust-analyzer cargo darling 0.23.0 crate/::utilrust-analyzer cargo darling_core 0.23.0 util/::{Flagrust-analyzer cargo darling_core 0.23.0 util/flag/Flag#, PathListrust-analyzer cargo darling_core 0.23.0 util/path_list/PathList#, SpannedValuerust-analyzer cargo darling_core 0.23.0 util/spanned_value/SpannedValue#};
7 use darlingrust-analyzer cargo darling 0.23.0 crate/::{Errorrust-analyzer cargo darling_core 0.23.0 error/Error#, FromMetarust-analyzer cargo darling_core 0.23.0 from_meta/FromMeta#};
8 use proc_macro2rust-analyzer cargo proc-macro2 1.0.107 crate/::Spanrust-analyzer cargo proc-macro2 1.0.107 Span#;
9 use synrust-analyzer cargo syn 2.0.119 crate/::{spannedrust-analyzer cargo syn 2.0.119 spanned/::Spannedrust-analyzer cargo syn 2.0.119 spanned/Spanned#, Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#, Genericsrust-analyzer cargo syn 2.0.119 generics/Generics#, Identrust-analyzer cargo proc-macro2 1.0.107 Ident#, Metarust-analyzer cargo syn 2.0.119 attr/Meta#, Pathrust-analyzer cargo syn 2.0.119 path/Path#};
10
11 use craterust-analyzer cargo derive_builder_core 0.20.2 crate/::{
12 BlockContentsrust-analyzer cargo derive_builder_core 0.20.2 block/BlockContents#, Builderrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#, BuilderFieldrust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderField#, BuilderFieldTyperust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderFieldType#, BuilderPatternrust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern#, DefaultExpressionrust-analyzer cargo derive_builder_core 0.20.2 default_expression/DefaultExpression#,
13 Eachrust-analyzer cargo derive_builder_core 0.20.2 options/Each#, FieldConversionrust-analyzer cargo derive_builder_core 0.20.2 initializer/FieldConversion#, Initializerrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#, Setterrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#,
14 };
15
16 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
17 enum VisibilityAttrrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr# {
18 /// `public`
19 Publicrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#Public#(Spanrust-analyzer cargo proc-macro2 1.0.107 Span#),
20 /// `private`
21 Privaterust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#Private#,
22 /// `vis = "pub(crate)"`
23 Explicitrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#Explicit#(synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#),
24 Nonerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#None#,
25 }
26
27 impl VisibilityAttrrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr# {
28 pub fn to_explicit_visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]to_explicit_visibility().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#>> {
29 match self {
30 Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]::Publicrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#Public#(span) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#::Publicrust-analyzer cargo syn 2.0.119 restriction/Visibility#Public#(
31 parse_quote_spannedrust-analyzer cargo syn 2.0.119 parse_quote/parse_quote_spanned!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().span=> pub),
32 ))),
33 Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]::Privaterust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#Private# => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#::Inheritedrust-analyzer cargo syn 2.0.119 restriction/Visibility#Inherited#)),
34 Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]::Explicitrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#Explicit#(v) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(v)),
35 Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]::Nonerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#None# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
36 }
37 }
38 }
39
40 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for VisibilityAttrrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr# {
41 fn defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][Default]default().() -> Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][Default] {
42 Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][Default]::Nonerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#None#
43 }
44 }
45
46 impl FromMetarust-analyzer cargo darling_core 0.23.0 from_meta/FromMeta# for VisibilityAttrrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr# {
47 fn from_listrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][FromMeta]from_list().(items: &[darlingrust-analyzer cargo darling 0.23.0 crate/::astrust-analyzer cargo darling_core 0.23.0 ast/::NestedMetarust-analyzer cargo darling_core 0.23.0 ast/data/nested_meta/NestedMeta#]) -> darlingrust-analyzer cargo darling 0.23.0 crate/::Resultrust-analyzer cargo darling_core 0.23.0 error/Result#<Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][FromMeta]> {
48 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(FromMetarust-analyzer cargo darling_macro 0.23.0 FromMeta:)]
49 struct VisibilityAttrInternalrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttrInternal# {
50 publicrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttrInternal#public.: Flagrust-analyzer cargo darling_core 0.23.0 util/flag/Flag#,
51 privaterust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttrInternal#private.: Flagrust-analyzer cargo darling_core 0.23.0 util/flag/Flag#,
52 visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttrInternal#vis.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#>,
53 }
54
55 let VisibilityAttrInternalrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttrInternal# {
56 publicrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttrInternal#public.,
57 privaterust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttrInternal#private.,
58 visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttrInternal#vis.: explicit,
59 } = VisibilityAttrInternalrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttrInternal#::from_listrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttrInternal][FromMeta]from_list().(items)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
60
61 let mut conflicts = Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::accumulatorrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]accumulator().();
62
63 if public.is_presentrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]is_present().() {
64 if private.is_presentrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]is_present().() {
65 conflicts.pushrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]push().(
66 Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::customrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]custom().("`public` and `private` cannot be used together")
67 .with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(&private.spanrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]span().()),
68 );
69 }
70
71 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(vis) = explicit {
72 conflicts.pushrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]push().(
73 Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::customrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]custom().("`public` and `vis` cannot be used together").with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(&vis),
74 );
75 }
76
77 conflicts.finish_withrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]finish_with().(Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][FromMeta]::Publicrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#Public#(public.spanrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]span().()))
78 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(vis) = explicit {
79 if private.is_presentrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]is_present().() {
80 conflicts.pushrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]push().(Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::customrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]custom().("`vis` and `private` cannot be used together"));
81 }
82
83 conflicts.finish_withrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]finish_with().(Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][FromMeta]::Explicitrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#Explicit#(vis))
84 } else if private.is_presentrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]is_present().() {
85 conflicts.finish_withrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]finish_with().(Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][FromMeta]::Privaterust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#Private#)
86 } else {
87 conflicts.finish_withrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]finish_with().(Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][FromMeta]::Nonerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#None#)
88 }
89 }
90 }
91
92 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, FromMetarust-analyzer cargo darling_macro 0.23.0 FromMeta:)]
93 struct BuildFnErrorGeneratedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnErrorGenerated# {
94 /// Indicates whether or not the generated error should have
95 /// a validation variant that takes a `String` as its contents.
96 validation_errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnErrorGenerated#validation_error.: SpannedValuerust-analyzer cargo darling_core 0.23.0 util/spanned_value/SpannedValue#<bool>,
97 }
98
99 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
100 enum BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError# {
101 Existingrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Existing#(Pathrust-analyzer cargo syn 2.0.119 path/Path#),
102 Generatedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Generated#(BuildFnErrorGeneratedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnErrorGenerated#),
103 }
104
105 impl BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError# {
106 fn as_existingrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFnError]as_existing().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Pathrust-analyzer cargo syn 2.0.119 path/Path#> {
107 match self {
108 BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#::Existingrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Existing#(p) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(p),
109 BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#::Generatedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Generated#(_) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
110 }
111 }
112
113 fn as_generatedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFnError]as_generated().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&BuildFnErrorGeneratedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnErrorGenerated#> {
114 match self {
115 BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#::Generatedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Generated#(e) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e),
116 BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#::Existingrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Existing#(_) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
117 }
118 }
119 }
120
121 impl FromMetarust-analyzer cargo darling_core 0.23.0 from_meta/FromMeta# for BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError# {
122 fn from_metarust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFnError][FromMeta]from_meta().(item: &Metarust-analyzer cargo syn 2.0.119 attr/Meta#) -> darlingrust-analyzer cargo darling 0.23.0 crate/::Resultrust-analyzer cargo darling_core 0.23.0 error/Result#<Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFnError][FromMeta]> {
123 match item {
124 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Pathrust-analyzer cargo syn 2.0.119 attr/Meta#Path#(_) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::unsupported_formatrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]unsupported_format().("word").with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(item)),
125 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Listrust-analyzer cargo syn 2.0.119 attr/Meta#List#(_) => BuildFnErrorGeneratedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnErrorGenerated#::from_metarust-analyzer cargo darling_core 0.23.0 from_meta/FromMeta#from_meta().(item).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFnError][FromMeta]::Generatedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Generated#),
126 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::NameValuerust-analyzer cargo syn 2.0.119 attr/Meta#NameValue#(i) => Pathrust-analyzer cargo syn 2.0.119 path/Path#::from_exprrust-analyzer cargo darling_core 0.23.0 from_meta/impl#[`syn::Path`][FromMeta]from_expr().(&i.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFnError][FromMeta]::Existingrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Existing#),
127 }
128 }
129 }
130
131 /// Options for the `build_fn` property in struct-level builder options.
132 /// There is no inheritance for these settings from struct-level to field-level,
133 /// so we don't bother using `Option` for values in this struct.
134 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, FromMetarust-analyzer cargo darling_macro 0.23.0 FromMeta:)]
135 #[darling(defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFn][Default]default()., and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]and_then(). = Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFn][FromMeta]::validation_needs_errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFn]validation_needs_error().)]
136 pub struct BuildFnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn# {
137 skiprust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#skip.: bool,
138 namerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#name.: Identrust-analyzer cargo proc-macro2 1.0.107 Ident#,
139 validaterust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#validate.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Pathrust-analyzer cargo syn 2.0.119 path/Path#>,
140 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(flatten)]
141 visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#visibility.: VisibilityAttrrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#,
142 /// Either the path to an existing error type that the build method should return or a meta
143 /// list of options to modify the generated error.
144 ///
145 /// Setting this to a path will prevent `derive_builder` from generating an error type for the
146 /// build method.
147 ///
148 /// This options supports to formats: path `error = "path::to::Error"` and meta list
149 /// `error(<options>)`. Supported mata list options are the following:
150 ///
151 /// * `validation_error = bool` - Whether to generate `ValidationError(String)` as a variant
152 /// of the build error type. Setting this to `false` will prevent `derive_builder` from
153 /// using the `validate` function but this also means it does not generate any usage of the
154 /// `alloc` crate (useful when disabling the `alloc` feature in `no_std`).
155 ///
156 /// # Type Bounds for Custom Error
157 /// This type's bounds depend on other settings of the builder.
158 ///
159 /// * If uninitialized fields cause `build()` to fail, then this type
160 /// must `impl From<UninitializedFieldError>`. Uninitialized fields do not cause errors
161 /// when default values are provided for every field or at the struct level.
162 /// * If `validate` is specified, then this type must provide a conversion from the specified
163 /// function's error type.
164 errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#error.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#>,
165 }
166
167 impl BuildFnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn# {
168 fn validation_needs_errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFn]validation_needs_error().(self) -> darlingrust-analyzer cargo darling 0.23.0 crate/::Resultrust-analyzer cargo darling_core 0.23.0 error/Result#<Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFn]> {
169 let mut acc = Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::accumulatorrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]accumulator().();
170 if self.validaterust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#validate..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
171 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#::Generatedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Generated#(e)) = &self.errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#error. {
172 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().*rust-analyzer cargo darling_core 0.23.0 util/spanned_value/impl#[`SpannedValue<T>`][Deref]deref().e.validation_errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnErrorGenerated#validation_error. {
173 acc.pushrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]push().(
174 Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::customrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]custom().(
175 "Cannot set `error(validation_error = false)` when using `validate`",
176 )
177 .with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(&e.validation_errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnErrorGenerated#validation_error..spanrust-analyzer cargo darling_core 0.23.0 util/spanned_value/impl#[`SpannedValue<T>`]span().()),
178 )
179 }
180 }
181 }
182
183 acc.finish_withrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]finish_with().(self)
184 }
185 }
186
187 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for BuildFnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn# {
188 fn defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFn][Default]default().() -> Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFn][Default] {
189 BuildFnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn# {
190 skiprust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#skip.: false,
191 namerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#name.: Identrust-analyzer cargo proc-macro2 1.0.107 Ident#::newrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]new().("build", Spanrust-analyzer cargo proc-macro2 1.0.107 Span#::call_siterust-analyzer cargo proc-macro2 1.0.107 impl#[Span]call_site().()),
192 validaterust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#validate.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
193 visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#visibility.: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][Default]default().(),
194 errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#error.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
195 }
196 }
197 }
198
199 /// Contents of the `field` meta in `builder` attributes at the field level.
200 //
201 // This is a superset of the attributes permitted in `field` at the struct level.
202 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, FromMetarust-analyzer cargo darling_macro 0.23.0 FromMeta:)]
203 pub struct FieldLevelFieldMetarust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta# {
204 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(flatten)]
205 visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#visibility.: VisibilityAttrrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#,
206 /// Custom builder field type
207 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(rename = "ty")]
208 builder_typerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#builder_type.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<synrust-analyzer cargo syn 2.0.119 crate/::Typerust-analyzer cargo syn 2.0.119 ty/Type#>,
209 /// Custom builder field method, for making target struct field value
210 buildrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#build.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<BlockContentsrust-analyzer cargo derive_builder_core 0.20.2 block/BlockContents#>,
211 }
212
213 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, FromMetarust-analyzer cargo darling_macro 0.23.0 FromMeta:)]
214 pub struct StructLevelSetterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter# {
215 prefixrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter#prefix.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#>,
216 intorust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter#into.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
217 strip_optionrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter#strip_option.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
218 skiprust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter#skip.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
219 }
220
221 impl StructLevelSetterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter# {
222 /// Check if setters are explicitly enabled or disabled at
223 /// the struct level.
224 pub fn enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructLevelSetter]enabled().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool> {
225 self.skiprust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter#skip..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|x| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().x)
226 }
227 }
228
229 /// Create `Each` from an attribute's `Meta`.
230 ///
231 /// Two formats are supported:
232 ///
233 /// * `each = "..."`, which provides the name of the `each` setter and otherwise uses default values
234 /// * `each(name = "...")`, which allows setting additional options on the `each` setter
235 fn parse_eachrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/parse_each().(meta: &Metarust-analyzer cargo syn 2.0.119 attr/Meta#) -> darlingrust-analyzer cargo darling 0.23.0 crate/::Resultrust-analyzer cargo darling_core 0.23.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Eachrust-analyzer cargo derive_builder_core 0.20.2 options/Each#>> {
236 if let Metarust-analyzer cargo syn 2.0.119 attr/Meta#::NameValuerust-analyzer cargo syn 2.0.119 attr/Meta#NameValue#(mnv) = meta {
237 Identrust-analyzer cargo proc-macro2 1.0.107 Ident#::from_metarust-analyzer cargo darling_core 0.23.0 from_meta/FromMeta#from_meta().(meta)
238 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Eachrust-analyzer cargo derive_builder_core 0.20.2 options/Each#::fromrust-analyzer cargo derive_builder_core 0.20.2 options/impl#[Each][`From<syn::Ident>`]from().)
239 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#)
240 .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| e.with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(&mnv.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value.))
241 } else {
242 Eachrust-analyzer cargo derive_builder_core 0.20.2 options/Each#::from_metarust-analyzer cargo darling_core 0.23.0 from_meta/FromMeta#from_meta().(meta).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#)
243 }
244 }
245
246 /// The `setter` meta item on fields in the input type.
247 /// Unlike the `setter` meta item at the struct level, this allows specific
248 /// name overrides.
249 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, FromMetarust-analyzer cargo darling_macro 0.23.0 FromMeta:)]
250 pub struct FieldLevelSetterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter# {
251 prefixrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#prefix.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#>,
252 namerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#name.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#>,
253 intorust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#into.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
254 strip_optionrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#strip_option.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
255 skiprust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#skip.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
256 customrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#custom.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
257 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(with = parse_eachrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/parse_each().)]
258 eachrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#each.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Eachrust-analyzer cargo derive_builder_core 0.20.2 options/Each#>,
259 }
260
261 impl FieldLevelSetterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter# {
262 /// Get whether the setter should be emitted. The rules are the same as
263 /// for `field_enabled`, except we only skip the setter if `setter(custom)` is present.
264 pub fn setter_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldLevelSetter]setter_enabled().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool> {
265 if self.customrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#custom..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
266 return self.customrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#custom..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|x| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().x);
267 }
268
269 self.field_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldLevelSetter]field_enabled().()
270 }
271
272 /// Get whether or not this field-level setter indicates a setter and
273 /// field should be emitted. The setter shorthand rules are that the
274 /// presence of a `setter` with _any_ properties set forces the setter
275 /// to be emitted.
276 pub fn field_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldLevelSetter]field_enabled().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool> {
277 if self.skiprust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#skip..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
278 return self.skiprust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#skip..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|x| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().x);
279 }
280
281 if self.prefixrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#prefix..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
282 || self.namerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#name..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
283 || self.intorust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#into..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
284 || self.strip_optionrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#strip_option..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
285 || self.eachrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#each..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
286 {
287 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true);
288 }
289
290 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
291 }
292 }
293
294 /// `derive_builder` allows the calling code to use `setter` as a word to enable
295 /// setters when they've been disabled at the struct level.
296 fn field_setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/field_setter().(meta: &Metarust-analyzer cargo syn 2.0.119 attr/Meta#) -> darlingrust-analyzer cargo darling 0.23.0 crate/::Resultrust-analyzer cargo darling_core 0.23.0 error/Result#<FieldLevelSetterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#> {
297 // it doesn't matter what the path is; the fact that this function
298 // has been called means that a valueless path is the shorthand case.
299 if let Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Pathrust-analyzer cargo syn 2.0.119 attr/Meta#Path#(_) = meta {
300 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(FieldLevelSetterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter# {
301 skiprust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#skip.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false),
302 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldLevelSetter][Default]default().()
303 })
304 } else {
305 FieldLevelSetterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#::from_metarust-analyzer cargo darling_core 0.23.0 from_meta/FromMeta#from_meta().(meta)
306 }
307 }
308
309 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)]
310 struct FieldForwardedAttrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldForwardedAttrs# {
311 pub fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldForwardedAttrs#field.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>,
312 pub setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldForwardedAttrs#setter.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>,
313 }
314
315 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>> for FieldForwardedAttrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldForwardedAttrs# {
316 type Errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldForwardedAttrs][`TryFrom<Vec<Attribute>>`]Error# = Errorrust-analyzer cargo darling_core 0.23.0 error/Error#;
317
318 fn try_fromrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldForwardedAttrs][`TryFrom<Vec<Attribute>>`]try_from().(value: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldForwardedAttrs][`TryFrom<Vec<Attribute>>`], Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldForwardedAttrs][`TryFrom<Vec<Attribute>>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
319 let mut result = Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldForwardedAttrs][`TryFrom<Vec<Attribute>>`]::defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldForwardedAttrs][Default]default().();
320 distribute_and_unnest_attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/distribute_and_unnest_attrs().(
321 value,
322 &mut [
323 ("builder_field_attr", &mut result.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldForwardedAttrs#field.),
324 ("builder_setter_attr", &mut result.setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldForwardedAttrs#setter.),
325 ],
326 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
327 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
328 }
329 }
330
331 /// Data extracted from the fields of the input struct.
332 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, FromFieldrust-analyzer cargo darling_macro 0.23.0 FromField:)]
333 #[darling(
334 attributes(builder),
335 forward_attrs(doc, cfg, allow, builder_field_attr, builder_setter_attr),
336 and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]and_then(). = "Self::resolve"
337 )]
338 pub struct Fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field# {
339 identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#ident.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#>,
340 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(with = TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#::try_fromrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldForwardedAttrs][`TryFrom<Vec<Attribute>>`]try_from().)]
341 attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#attrs.: FieldForwardedAttrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldForwardedAttrs#,
342 tyrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#ty.: synrust-analyzer cargo syn 2.0.119 crate/::Typerust-analyzer cargo syn 2.0.119 ty/Type#,
343 /// Field-level override for builder pattern.
344 /// Note that setting this may force the builder to derive `Clone`.
345 patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#pattern.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<BuilderPatternrust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern#>,
346 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(flatten)]
347 visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#visibility.: VisibilityAttrrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#,
348 // See the documentation for `FieldSetterMeta` to understand how `darling`
349 // is interpreting this field.
350 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldLevelSetter][Default]default()., with = field_setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/field_setter().)]
351 setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#setter.: FieldLevelSetterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#,
352 /// The value for this field if the setter is never invoked.
353 ///
354 /// A field can get its default one of three ways:
355 ///
356 /// 1. An explicit `default = "..."` expression
357 /// 2. An explicit `default` word, in which case the field type's `Default::default()`
358 /// value is used
359 /// 3. Inherited from the field's value in the struct's `default` value.
360 ///
361 /// This property only captures the first two, the third is computed in `FieldWithDefaults`.
362 defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#default.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DefaultExpressionrust-analyzer cargo derive_builder_core 0.20.2 default_expression/DefaultExpression#>,
363 try_setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#try_setter.: Flagrust-analyzer cargo darling_core 0.23.0 util/flag/Flag#,
364 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldLevelFieldMeta][Default]default().)]
365 fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#field.: FieldLevelFieldMetarust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#,
366 }
367
368 impl Fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field# {
369 /// Resolve and check (post-parsing) options which come from multiple darling options
370 ///
371 /// * Check that we don't have a custom field type or builder *and* a default value
372 fn resolverust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Field]resolve().(self) -> darlingrust-analyzer cargo darling 0.23.0 crate/::Resultrust-analyzer cargo darling_core 0.23.0 error/Result#<Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Field]> {
373 let mut errors = darlingrust-analyzer cargo darling 0.23.0 crate/::Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::accumulatorrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]accumulator().();
374
375 // `default` can be preempted by properties in `field`. Silently ignoring a
376 // `default` could cause the direct user of `derive_builder` to see unexpected
377 // behavior from the builder, so instead we require that the deriving struct
378 // not pass any ignored instructions.
379 if let Fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field# {
380 defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#default.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(field_default),
381 ..
382 } = &self
383 {
384 // `field.build` is stronger than `default`, as it contains both instructions on how to
385 // deal with a missing value and conversions to do on the value during target type
386 // construction.
387 if self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#field..buildrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#build..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
388 errors.pushrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]push().(
389 darlingrust-analyzer cargo darling 0.23.0 crate/::Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::customrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]custom().(
390 r#"#[builder(default)] and #[builder(field(build="..."))] cannot be used together"#,
391 )
392 .with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(&field_default.spanrust-analyzer cargo derive_builder_core 0.20.2 default_expression/impl#[DefaultExpression]span().()),
393 );
394 }
395
396 // `field.ty` being set means `default` will not be used, since we don't know how
397 // to check a custom field type for the absence of a value and therefore we'll never
398 // know that we should use the `default` value.
399 if self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#field..builder_typerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#builder_type..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
400 errors.pushrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]push().(
401 darlingrust-analyzer cargo darling 0.23.0 crate/::Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::customrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]custom().(
402 r#"#[builder(default)] and #[builder(field(ty="..."))] cannot be used together"#,
403 )
404 .with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(&field_default.spanrust-analyzer cargo derive_builder_core 0.20.2 default_expression/impl#[DefaultExpression]span().())
405 )
406 }
407 };
408
409 errors.finish_withrust-analyzer cargo darling_core 0.23.0 error/impl#[Accumulator]finish_with().(self)
410 }
411 }
412
413 /// Divide a list of attributes into multiple partially-overlapping output lists.
414 ///
415 /// Some attributes from the macro input will be added to the output in multiple places;
416 /// for example, a `cfg` attribute must be replicated to both the struct and its impl block or
417 /// the resulting code will not compile.
418 ///
419 /// Other attributes are scoped to a specific output by their path, e.g. `builder_field_attr`.
420 /// These attributes will only appear in one output list, but need that outer path removed.
421 ///
422 /// For performance reasons, we want to do this in one pass through the list instead of
423 /// first distributing and then iterating through each of the output lists.
424 ///
425 /// Each item in `outputs` contains the attribute name unique to that output, and the `Vec` where all attributes for that output should be inserted.
426 /// Attributes whose path matches any value in `outputs` will be added only to the first matching one, and will be "unnested".
427 /// Other attributes are not unnested, and simply copied for each decoratee.
428 fn distribute_and_unnest_attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/distribute_and_unnest_attrs().(
429 mut input: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>,
430 outputs: &mut [(&'static str, &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>)],
431 ) -> darlingrust-analyzer cargo darling 0.23.0 crate/::Resultrust-analyzer cargo darling_core 0.23.0 error/Result#<()> {
432 let mut errors = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
433
434 for (name, list) in &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().outputs {
435 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(list.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().(), "Output Vec for '{}' was not empty", name);
436 }
437
438 for attr in input.drainrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]drain().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#) {
439 let destination = outputs
440 .iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().()
441 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]find().(|(ptattr, _)| attr.pathrust-analyzer cargo syn 2.0.119 attr/impl#[Attribute]path().().is_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]is_ident().(ptattr));
442
443 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((_, destination)) = destination {
444 match unnest_from_one_attributerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/unnest_from_one_attribute().(attr) {
445 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(n) => destination.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(n),
446 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => errors.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(e),
447 }
448 } else {
449 for (_, output) in outputs.iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().() {
450 output.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(attr.clonerust-analyzer cargo syn 2.0.119 gen/clone/impl#[`crate::Attribute`][Clone]clone().());
451 }
452 }
453 }
454
455 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().errors.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
456 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(darlingrust-analyzer cargo darling 0.23.0 crate/::Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::multiplerust-analyzer cargo darling_core 0.23.0 error/impl#[Error]multiple().(errors));
457 }
458
459 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
460 }
461
462 fn unnest_from_one_attributerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/unnest_from_one_attribute().(attr: synrust-analyzer cargo syn 2.0.119 crate/::Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#) -> darlingrust-analyzer cargo darling 0.23.0 crate/::Resultrust-analyzer cargo darling_core 0.23.0 error/Result#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#> {
463 match &attr.stylerust-analyzer cargo syn 2.0.119 attr/Attribute#style. {
464 synrust-analyzer cargo syn 2.0.119 crate/::AttrStylerust-analyzer cargo syn 2.0.119 attr/AttrStyle#::Outerrust-analyzer cargo syn 2.0.119 attr/AttrStyle#Outer# => (),
465 synrust-analyzer cargo syn 2.0.119 crate/::AttrStylerust-analyzer cargo syn 2.0.119 attr/AttrStyle#::Innerrust-analyzer cargo syn 2.0.119 attr/AttrStyle#Inner#(bang) => {
466 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(darlingrust-analyzer cargo darling 0.23.0 crate/::Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::unsupported_formatrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]unsupported_format().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
467 "{} must be an outer attribute",
468 attr.pathrust-analyzer cargo syn 2.0.119 attr/impl#[Attribute]path().()
469 .get_identrust-analyzer cargo syn 2.0.119 path/impl#[Path]get_ident().()
470 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Identrust-analyzer cargo proc-macro2 1.0.107 Ident#::to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().)
471 .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| "Attribute".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
472 ))
473 .with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(bang));
474 }
475 };
476
477 let original_span = attr.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().();
478
479 let pound = attr.pound_tokenrust-analyzer cargo syn 2.0.119 attr/Attribute#pound_token.;
480 let meta = attr.metarust-analyzer cargo syn 2.0.119 attr/Attribute#meta.;
481
482 match meta {
483 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Pathrust-analyzer cargo syn 2.0.119 attr/Meta#Path#(_) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::unsupported_formatrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]unsupported_format().("word").with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(&meta)),
484 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::NameValuerust-analyzer cargo syn 2.0.119 attr/Meta#NameValue#(_) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo darling_core 0.23.0 error/Error#::unsupported_formatrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]unsupported_format().("name-value").with_spanrust-analyzer cargo darling_core 0.23.0 error/impl#[Error]with_span().(&meta)),
485 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Listrust-analyzer cargo syn 2.0.119 attr/Meta#List#(list) => {
486 let inner = list.tokensrust-analyzer cargo syn 2.0.119 attr/MetaList#tokens.;
487 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(parse_quote_spannedrust-analyzer cargo syn 2.0.119 parse_quote/parse_quote_spanned!!(original_span=> #pound [ #inner ]))
488 }
489 }
490 }
491
492 fn default_crate_rootrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/default_crate_root().() -> Pathrust-analyzer cargo syn 2.0.119 path/Path# {
493 parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(::derive_builder)
494 }
495
496 fn default_create_emptyrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/default_create_empty().() -> Identrust-analyzer cargo proc-macro2 1.0.107 Ident# {
497 Identrust-analyzer cargo proc-macro2 1.0.107 Ident#::newrust-analyzer cargo proc-macro2 1.0.107 impl#[Ident]new().("create_empty", Spanrust-analyzer cargo proc-macro2 1.0.107 Span#::call_siterust-analyzer cargo proc-macro2 1.0.107 impl#[Span]call_site().())
498 }
499
500 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)]
501 struct StructForwardedAttrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructForwardedAttrs# {
502 struct_attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructForwardedAttrs#struct_attrs.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>,
503 impl_attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructForwardedAttrs#impl_attrs.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>,
504 }
505
506 impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>> for StructForwardedAttrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructForwardedAttrs# {
507 type Errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructForwardedAttrs][`TryFrom<Vec<Attribute>>`]Error# = Errorrust-analyzer cargo darling_core 0.23.0 error/Error#;
508
509 fn try_fromrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructForwardedAttrs][`TryFrom<Vec<Attribute>>`]try_from().(value: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Attributerust-analyzer cargo syn 2.0.119 attr/Attribute#>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructForwardedAttrs][`TryFrom<Vec<Attribute>>`], Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructForwardedAttrs][`TryFrom<Vec<Attribute>>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> {
510 let mut result = Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructForwardedAttrs][`TryFrom<Vec<Attribute>>`]::defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructForwardedAttrs][Default]default().();
511 distribute_and_unnest_attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/distribute_and_unnest_attrs().(
512 value,
513 &mut [
514 ("builder_struct_attr", &mut result.struct_attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructForwardedAttrs#struct_attrs.),
515 ("builder_impl_attr", &mut result.impl_attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructForwardedAttrs#impl_attrs.),
516 ],
517 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
518
519 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
520 }
521 }
522
523 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, FromDeriveInputrust-analyzer cargo darling_macro 0.23.0 FromDeriveInput:)]
524 #[darling(
525 attributes(builder),
526 forward_attrs(cfg, allow, builder_struct_attr, builder_impl_attr),
527 supports(struct_named)
528 )]
529 pub struct Optionsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options# {
530 identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#ident.: Identrust-analyzer cargo proc-macro2 1.0.107 Ident#,
531
532 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(with = TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#::try_fromrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructForwardedAttrs][`TryFrom<Vec<Attribute>>`]try_from().)]
533 attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#attrs.: StructForwardedAttrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructForwardedAttrs#,
534
535 /// The visibility of the deriving struct. Do not confuse this with `#[builder(vis = "...")]`,
536 /// which is received by `Options::visibility`.
537 visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#vis.: synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#,
538
539 genericsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#generics.: Genericsrust-analyzer cargo syn 2.0.119 generics/Generics#,
540
541 /// The name of the generated builder. Defaults to `#{ident}Builder`.
542 namerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#name.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Identrust-analyzer cargo proc-macro2 1.0.107 Ident#>,
543
544 /// The path to the root of the derive_builder crate used in generated
545 /// code.
546 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(rename = "crate", default = default_crate_rootrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/default_crate_root().)]
547 crate_rootrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#crate_root.: Pathrust-analyzer cargo syn 2.0.119 path/Path#,
548
549 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(defaultrust-analyzer cargo derive_builder_core 0.20.2 options/impl#[BuilderPattern][Default]default().)]
550 patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#pattern.: BuilderPatternrust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern#,
551
552 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFn][Default]default().)]
553 build_fnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#build_fn.: BuildFnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#,
554
555 /// Additional traits to derive on the builder.
556 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(defaultrust-analyzer cargo darling_core 0.23.0 util/path_list/impl#[PathList][Default]default().)]
557 deriverust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#derive.: PathListrust-analyzer cargo darling_core 0.23.0 util/path_list/PathList#,
558
559 custom_constructorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#custom_constructor.: Flagrust-analyzer cargo darling_core 0.23.0 util/flag/Flag#,
560
561 /// The ident of the inherent method which takes no arguments and returns
562 /// an instance of the builder with all fields empty.
563 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(default = default_create_emptyrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/default_create_empty().)]
564 create_emptyrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#create_empty.: Identrust-analyzer cargo proc-macro2 1.0.107 Ident#,
565
566 /// Setter options applied to all field setters in the struct.
567 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructLevelSetter][Default]default().)]
568 setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#setter.: StructLevelSetterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter#,
569
570 /// Struct-level value to use in place of any unfilled fields
571 defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#default.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DefaultExpressionrust-analyzer cargo derive_builder_core 0.20.2 default_expression/DefaultExpression#>,
572
573 /// Desired visibility of the builder struct.
574 ///
575 /// Do not confuse this with `Options::vis`, which is the visibility of the deriving struct.
576 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(flatten)]
577 visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#visibility.: VisibilityAttrrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#,
578
579 /// The parsed body of the derived struct.
580 datarust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#data.: darlingrust-analyzer cargo darling 0.23.0 crate/::astrust-analyzer cargo darling_core 0.23.0 ast/::Datarust-analyzer cargo darling_core 0.23.0 ast/data/Data#<darlingrust-analyzer cargo darling 0.23.0 crate/::utilrust-analyzer cargo darling_core 0.23.0 util/::Ignoredrust-analyzer cargo darling_core 0.23.0 util/ignored/Ignored#, Fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#>,
581
582 no_stdrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#no_std.: Flagrust-analyzer cargo darling_core 0.23.0 util/flag/Flag#,
583
584 /// When present, emit additional fallible setters alongside each regular
585 /// setter.
586 try_setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#try_setter.: Flagrust-analyzer cargo darling_core 0.23.0 util/flag/Flag#,
587
588 #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr][Default]default().)]
589 fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#field.: VisibilityAttrrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/VisibilityAttr#,
590 }
591
592 /// Accessors for parsed properties.
593 impl Optionsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options# {
594 pub fn builder_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]builder_ident().(&self) -> Identrust-analyzer cargo proc-macro2 1.0.107 Ident# {
595 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref custom) = self.namerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#name. {
596 return custom.clonerust-analyzer cargo proc-macro2 1.0.107 impl#[Ident][Clone]clone().();
597 }
598
599 format_identrust-analyzer cargo quote 1.0.47 format/format_ident!!("{}Builder", self.identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#ident.)
600 }
601
602 pub fn builder_error_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]builder_error_ident().(&self) -> Pathrust-analyzer cargo syn 2.0.119 path/Path# {
603 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#::Existingrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Existing#(existing)) = self.build_fnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#build_fn..errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#error..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() {
604 existing.clonerust-analyzer cargo syn 2.0.119 gen/clone/impl#[`crate::Path`][Clone]clone().()
605 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref custom) = self.namerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#name. {
606 format_identrust-analyzer cargo quote 1.0.47 format/format_ident!!("{}Error", custom).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
607 } else {
608 format_identrust-analyzer cargo quote 1.0.47 format/format_ident!!("{}BuilderError", self.identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#ident.).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
609 }
610 }
611
612 /// The visibility of the builder struct.
613 /// If a visibility was declared in attributes, that will be used;
614 /// otherwise the struct's own visibility will be used.
615 pub fn builder_visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]builder_vis().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#> {
616 self.visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#visibility.
617 .to_explicit_visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]to_explicit_visibility().()
618 .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(&self.visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#vis.))
619 }
620
621 /// Get the visibility of the emitted `build` method.
622 /// This defaults to the visibility of the parent builder, but can be overridden.
623 pub fn build_method_visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]build_method_vis().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#> {
624 self.build_fnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#build_fn.
625 .visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#visibility.
626 .to_explicit_visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]to_explicit_visibility().()
627 .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| self.builder_visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]builder_vis().())
628 }
629
630 pub fn raw_fieldsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]raw_fields().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&Fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#> {
631 self.datarust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#data.
632 .as_refrust-analyzer cargo darling_core 0.23.0 ast/data/impl#[`Data<V, F>`]as_ref().()
633 .take_structrust-analyzer cargo darling_core 0.23.0 ast/data/impl#[`Data<V, F>`]take_struct().()
634 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("Only structs supported")
635 .fieldsrust-analyzer cargo darling_core 0.23.0 ast/data/Fields#fields.
636 }
637
638 /// A builder requires `Clone` to be derived if its build method or any of its setters
639 /// use the mutable or immutable pattern.
640 pub fn requires_clonerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]requires_clone().(&self) -> bool {
641 self.patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#pattern..requires_clonerust-analyzer cargo derive_builder_core 0.20.2 options/impl#[BuilderPattern]requires_clone().() || self.fieldsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]fields().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|f| f.patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]pattern().().requires_clonerust-analyzer cargo derive_builder_core 0.20.2 options/impl#[BuilderPattern]requires_clone().())
642 }
643
644 /// Get an iterator over the input struct's fields which pulls fallback
645 /// values from struct-level settings.
646 pub fn fieldsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]fields().(&self) -> FieldIterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldIter# {
647 FieldIterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldIter#(self, self.raw_fieldsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]raw_fields().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().())
648 }
649
650 pub fn field_countrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]field_count().(&self) -> usize {
651 self.raw_fieldsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]raw_fields().().lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()
652 }
653 }
654
655 /// Converters to codegen structs
656 impl Optionsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options# {
657 pub fn as_builderrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]as_builder().(&self) -> Builderrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder# {
658 Builderrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder# {
659 crate_rootrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#crate_root.: &self.crate_rootrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#crate_root.,
660 enabledrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#enabled.: true,
661 identrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#ident.: self.builder_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]builder_ident().(),
662 patternrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#pattern.: self.patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#pattern.,
663 derivesrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#derives.: &self.deriverust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#derive.,
664 struct_attrsrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#struct_attrs.: &self.attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#attrs..struct_attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructForwardedAttrs#struct_attrs.,
665 impl_attrsrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#impl_attrs.: &self.attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#attrs..impl_attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructForwardedAttrs#impl_attrs.,
666 impl_defaultrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#impl_default.: !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.custom_constructorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#custom_constructor..is_presentrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]is_present().(),
667 create_emptyrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#create_empty.: self.create_emptyrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#create_empty..clonerust-analyzer cargo proc-macro2 1.0.107 impl#[Ident][Clone]clone().(),
668 genericsrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#generics.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&self.genericsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#generics.),
669 visibilityrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#visibility.: self.builder_visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]builder_vis().(),
670 fieldsrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#fields.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(self.field_countrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]field_count().()),
671 field_initializersrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#field_initializers.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(self.field_countrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]field_count().()),
672 functionsrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#functions.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(self.field_countrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]field_count().()),
673 generate_errorrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#generate_error.: self
674 .build_fnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#build_fn.
675 .errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#error.
676 .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
677 .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#::as_existingrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFnError]as_existing().)
678 .is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().(),
679 generate_validation_errorrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#generate_validation_error.: self
680 .build_fnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#build_fn.
681 .errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#error.
682 .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
683 .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#::as_generatedrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[BuildFnError]as_generated().)
684 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|e| *rust-analyzer cargo darling_core 0.23.0 util/spanned_value/impl#[`SpannedValue<T>`][Deref]deref().e.validation_errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnErrorGenerated#validation_error.)
685 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(true),
686 no_allocrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#no_alloc.: cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(not(any(feature = "alloc", feature = "lib_has_std"))),
687 must_derive_clonerust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#must_derive_clone.: self.requires_clonerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]requires_clone().(),
688 doc_commentrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#doc_comment.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
689 stdrust-analyzer cargo derive_builder_core 0.20.2 builder/Builder#std.: !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.no_stdrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#no_std..is_presentrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]is_present().(),
690 }
691 }
692
693 pub fn as_build_methodrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]as_build_method().(&self) -> BuildMethodrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod# {
694 let (_, ty_generics, _) = self.genericsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#generics..split_for_implrust-analyzer cargo syn 2.0.119 generics/impl#[Generics]split_for_impl().();
695 BuildMethodrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod# {
696 crate_rootrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#crate_root.: &self.crate_rootrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#crate_root.,
697 enabledrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#enabled.: !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.build_fnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#build_fn..skiprust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#skip.,
698 identrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#ident.: &self.build_fnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#build_fn..namerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#name.,
699 visibilityrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#visibility.: self.build_method_visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]build_method_vis().(),
700 patternrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#pattern.: self.patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#pattern.,
701 target_tyrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#target_ty.: &self.identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#ident.,
702 target_ty_genericsrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#target_ty_generics.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ty_generics),
703 error_tyrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#error_ty.: self.builder_error_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]builder_error_ident().(),
704 initializersrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#initializers.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(self.field_countrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[Options]field_count().()),
705 doc_commentrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#doc_comment.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
706 default_structrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#default_struct.: self.defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#default..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(),
707 validate_fnrust-analyzer cargo derive_builder_core 0.20.2 build_method/BuildMethod#validate_fn.: self.build_fnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#build_fn..validaterust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#validate..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(),
708 }
709 }
710 }
711
712 /// Accessor for field data which can pull through options from the parent
713 /// struct.
714 pub struct FieldWithDefaultsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#<'a> {
715 parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent.: &'a Optionsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#,
716 fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.: &'a Fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#,
717 }
718
719 /// Accessors for parsed properties, with transparent pull-through from the
720 /// parent struct's configuration.
721 impl<'a> FieldWithDefaultsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#<'a> {
722 /// Check if this field should emit a setter.
723 pub fn setter_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_enabled().(&self) -> bool {
724 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.
725 .setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#setter.
726 .setter_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldLevelSetter]setter_enabled().()
727 .or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#setter..enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructLevelSetter]enabled().())
728 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(true)
729 }
730
731 pub fn field_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_enabled().(&self) -> bool {
732 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.
733 .setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#setter.
734 .field_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[FieldLevelSetter]field_enabled().()
735 .or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#setter..enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[StructLevelSetter]enabled().())
736 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(true)
737 }
738
739 /// Check if this field should emit a fallible setter.
740 /// This depends on the `TryFrom` trait, which hasn't yet stabilized.
741 pub fn try_setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]try_setter().(&self) -> bool {
742 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..try_setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#try_setter..is_presentrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]is_present().() || self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..try_setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#try_setter..is_presentrust-analyzer cargo darling_core 0.23.0 util/flag/impl#[Flag]is_present().()
743 }
744
745 /// Get the prefix that should be applied to the field name to produce
746 /// the setter ident, if any.
747 pub fn setter_prefixrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_prefix().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Identrust-analyzer cargo proc-macro2 1.0.107 Ident#> {
748 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.
749 .setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#setter.
750 .prefixrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#prefix.
751 .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
752 .orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or().(self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#setter..prefixrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter#prefix..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().())
753 }
754
755 /// Get the ident of the emitted setter method
756 pub fn setter_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_ident().(&self) -> synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident# {
757 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref custom) = self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#setter..namerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#name. {
758 return custom.clonerust-analyzer cargo proc-macro2 1.0.107 impl#[Ident][Clone]clone().();
759 }
760
761 let ident = &self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#ident.;
762
763 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref prefix) = self.setter_prefixrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_prefix().() {
764 return format_identrust-analyzer cargo quote 1.0.47 format/format_ident!!("{}_{}", prefix, ident.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().());
765 }
766
767 ident.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
768 }
769
770 /// Checks if the emitted setter should be generic over types that impl
771 /// `Into<FieldType>`.
772 pub fn setter_intorust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_into().(&self) -> bool {
773 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.
774 .setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#setter.
775 .intorust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#into.
776 .orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or().(self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#setter..intorust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter#into.)
777 .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().()
778 }
779
780 /// Checks if the emitted setter should strip the wrapper Option over types that impl
781 /// `Option<FieldType>`.
782 pub fn setter_strip_optionrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_strip_option().(&self) -> bool {
783 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.
784 .setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#setter.
785 .strip_optionrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#strip_option.
786 .orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or().(self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#setter..strip_optionrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/StructLevelSetter#strip_option.)
787 .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().()
788 }
789
790 /// Get the visibility of the emitted setter, if there will be one.
791 pub fn setter_visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_vis().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#> {
792 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.
793 .visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#visibility.
794 .to_explicit_visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]to_explicit_visibility().()
795 .or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#visibility..to_explicit_visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]to_explicit_visibility().())
796 .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(synrust-analyzer cargo syn 2.0.119 crate/::parse_quoterust-analyzer cargo syn 2.0.119 parse_quote/parse_quote!!(pub)))
797 }
798
799 /// Get the ident of the input field. This is also used as the ident of the
800 /// emitted field.
801 pub fn field_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_ident().(&self) -> &synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident# {
802 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.
803 .identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#ident.
804 .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
805 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("Tuple structs are not supported")
806 }
807
808 pub fn field_visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_vis().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#> {
809 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.
810 .fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#field.
811 .visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#visibility.
812 .to_explicit_visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]to_explicit_visibility().()
813 .or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(
814 // Disabled fields become a PhantomData in the builder. We make that field
815 // non-public, even if the rest of the builder is public, since this field is just
816 // there to make sure the struct's generics are properly handled.
817 || {
818 if self.field_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_enabled().() {
819 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
820 } else {
821 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#::Inheritedrust-analyzer cargo syn 2.0.119 restriction/Visibility#Inherited#))
822 }
823 },
824 )
825 .or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#field..to_explicit_visibilityrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[VisibilityAttr]to_explicit_visibility().())
826 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(synrust-analyzer cargo syn 2.0.119 crate/::Visibilityrust-analyzer cargo syn 2.0.119 restriction/Visibility#::Inheritedrust-analyzer cargo syn 2.0.119 restriction/Visibility#Inherited#))
827 }
828
829 pub fn field_typerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_type().(&'a self) -> BuilderFieldTyperust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderFieldType#<'a> {
830 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.field_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_enabled().() {
831 BuilderFieldTyperust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderFieldType#::Phantomrust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderFieldType#Phantom#(&self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..tyrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#ty.)
832 } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(custom_ty) = self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#field..builder_typerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#builder_type..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() {
833 BuilderFieldTyperust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderFieldType#::Preciserust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderFieldType#Precise#(custom_ty)
834 } else {
835 BuilderFieldTyperust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderFieldType#::Optionalrust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderFieldType#Optional#(&self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..tyrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#ty.)
836 }
837 }
838
839 pub fn conversionrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]conversion().(&'a self) -> FieldConversionrust-analyzer cargo derive_builder_core 0.20.2 initializer/FieldConversion#<'a> {
840 match (&self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#field..builder_typerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#builder_type., &self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#field..buildrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelFieldMeta#build.) {
841 (_, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(block)) => FieldConversionrust-analyzer cargo derive_builder_core 0.20.2 initializer/FieldConversion#::Blockrust-analyzer cargo derive_builder_core 0.20.2 initializer/FieldConversion#Block#(block),
842 (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(_), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => FieldConversionrust-analyzer cargo derive_builder_core 0.20.2 initializer/FieldConversion#::Moverust-analyzer cargo derive_builder_core 0.20.2 initializer/FieldConversion#Move#,
843 (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => FieldConversionrust-analyzer cargo derive_builder_core 0.20.2 initializer/FieldConversion#::OptionOrDefaultrust-analyzer cargo derive_builder_core 0.20.2 initializer/FieldConversion#OptionOrDefault#,
844 }
845 }
846
847 pub fn patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]pattern().(&self) -> BuilderPatternrust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern# {
848 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#pattern..unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#pattern.)
849 }
850
851 pub fn use_parent_defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]use_parent_default().(&self) -> bool {
852 self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#default..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() && self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#default..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
853 }
854 }
855
856 /// Converters to codegen structs
857 impl<'a> FieldWithDefaultsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#<'a> {
858 /// Returns a `Setter` according to the options.
859 pub fn as_setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]as_setter().(&'a self) -> Setterrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#<'a> {
860 Setterrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter# {
861 crate_rootrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#crate_root.: &self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..crate_rootrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#crate_root.,
862 setter_enabledrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#setter_enabled.: self.setter_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_enabled().(),
863 try_setterrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#try_setter.: self.try_setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]try_setter().(),
864 visibilityrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#visibility.: self.setter_visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_vis().(),
865 patternrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#pattern.: self.patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]pattern().(),
866 attrsrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#attrs.: &self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#attrs..setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldForwardedAttrs#setter.,
867 identrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#ident.: self.setter_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_ident().(),
868 field_identrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#field_ident.: self.field_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_ident().(),
869 field_typerust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#field_type.: self.field_typerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_type().(),
870 generic_intorust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#generic_into.: self.setter_intorust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_into().(),
871 strip_optionrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#strip_option.: self.setter_strip_optionrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]setter_strip_option().(),
872 eachrust-analyzer cargo derive_builder_core 0.20.2 setter/Setter#each.: self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..setterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#setter..eachrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldLevelSetter#each..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(),
873 }
874 }
875
876 /// Returns an `Initializer` according to the options.
877 ///
878 /// # Panics
879 ///
880 /// if `default_expression` can not be parsed as `Block`.
881 pub fn as_initializerrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]as_initializer().(&'a self) -> Initializerrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#<'a> {
882 Initializerrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer# {
883 crate_rootrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#crate_root.: &self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..crate_rootrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#crate_root.,
884 field_enabledrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#field_enabled.: self.field_enabledrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_enabled().(),
885 field_identrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#field_ident.: self.field_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_ident().(),
886 builder_patternrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#builder_pattern.: self.patternrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]pattern().(),
887 default_valuerust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#default_value.: self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#default..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(),
888 use_default_structrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#use_default_struct.: self.use_parent_defaultrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]use_parent_default().(),
889 conversionrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#conversion.: self.conversionrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]conversion().(),
890 custom_error_type_spanrust-analyzer cargo derive_builder_core 0.20.2 initializer/Initializer#custom_error_type_span.: self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..build_fnrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#build_fn..errorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFn#error..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|err_ty| {
891 match err_ty {
892 BuildFnErrorrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#::Existingrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/BuildFnError#Existing#(p) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(p.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().()),
893 _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
894 }
895 }),
896 }
897 }
898
899 pub fn as_builder_fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]as_builder_field().(&'a self) -> BuilderFieldrust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderField#<'a> {
900 BuilderFieldrust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderField# {
901 crate_rootrust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderField#crate_root.: &self.parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent..crate_rootrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#crate_root.,
902 field_identrust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderField#field_ident.: self.field_identrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_ident().(),
903 field_typerust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderField#field_type.: self.field_typerust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_type().(),
904 field_visibilityrust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderField#field_visibility.: self.field_visrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldWithDefaults<'a>`]field_vis().(),
905 attrsrust-analyzer cargo derive_builder_core 0.20.2 builder_field/BuilderField#attrs.: &self.fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field..attrsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#attrs..fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldForwardedAttrs#field.,
906 }
907 }
908 }
909
910 pub struct FieldIterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldIter#<'a>(&'a Optionsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Options#, IntoIterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/IntoIter#<&'a Fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/Field#>);
911
912 impl<'a> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for FieldIterrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldIter#<'a> {
913 type Itemrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldIter<'a>`][Iterator]Item# = FieldWithDefaultsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#<'a>;
914
915 fn nextrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldIter<'a>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/impl#[`FieldIter<'a>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
916 self.1rust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldIter#1..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/impl#[`IntoIter<T, A>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|field| FieldWithDefaultsrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults# {
917 parentrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#parent.: self.0rust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldIter#0.,
918 fieldrust-analyzer cargo derive_builder_core 0.20.2 macro_options/darling_opts/FieldWithDefaults#field.,
919 })
920 }
921 }