| 1 | /// Controls the signature of a setter method, |
| 2 | /// more specifically how `self` is passed and returned. |
| 3 | /// |
| 4 | /// It can also be generalized to methods with different parameter sets and |
| 5 | /// return types, e.g. the `build()` method. |
| 6 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, 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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, FromMetarust-analyzer cargo darling_macro 0.23.0 FromMeta:)] |
| 7 | pub enum BuilderPatternrust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern# { |
| 8 | /// E.g. `fn bar(self, bar: Bar) -> Self`. |
| 9 | Ownedrust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern#Owned#, |
| 10 | /// E.g. `fn bar(&mut self, bar: Bar) -> &mut Self`. |
| 11 | Mutablerust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern#Mutable#, |
| 12 | /// E.g. `fn bar(&self, bar: Bar) -> Self`. |
| 13 | /// |
| 14 | /// Note: |
| 15 | /// - Needs to `clone` in order to return an _updated_ instance of `Self`. |
| 16 | /// - There is a great chance that the Rust compiler (LLVM) will |
| 17 | /// optimize chained `clone` calls away in release mode. |
| 18 | /// Therefore this turns out not to be as bad as it sounds. |
| 19 | Immutablerust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern#Immutable#, |
| 20 | } |
| 21 | |
| 22 | impl BuilderPatternrust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern# { |
| 23 | /// Returns true if this style of builder needs to be able to clone its |
| 24 | /// fields during the `build` method. |
| 25 | pub fn requires_clonerust-analyzer cargo derive_builder_core 0.20.2 options/impl#[BuilderPattern]requires_clone().(&self) -> bool { |
| 26 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Selfrust-analyzer cargo derive_builder_core 0.20.2 options/impl#[BuilderPattern]::Ownedrust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern#Owned# |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /// Defaults to `Mutable`. |
| 31 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for BuilderPatternrust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern# { |
| 32 | fn defaultrust-analyzer cargo derive_builder_core 0.20.2 options/impl#[BuilderPattern][Default]default().() -> Selfrust-analyzer cargo derive_builder_core 0.20.2 options/impl#[BuilderPattern][Default] { |
| 33 | Selfrust-analyzer cargo derive_builder_core 0.20.2 options/impl#[BuilderPattern][Default]::Mutablerust-analyzer cargo derive_builder_core 0.20.2 options/BuilderPattern#Mutable# |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | #[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:)] |
| 38 | pub struct Eachrust-analyzer cargo derive_builder_core 0.20.2 options/Each# { |
| 39 | pub namerust-analyzer cargo derive_builder_core 0.20.2 options/Each#name.: synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident#, |
| 40 | #[darlingrust-analyzer cargo darling_macro 0.23.0 darling:(defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/impl#[bool][Default]default().)] |
| 41 | pub intorust-analyzer cargo derive_builder_core 0.20.2 options/Each#into.: bool, |
| 42 | } |
| 43 | |
| 44 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident#> for Eachrust-analyzer cargo derive_builder_core 0.20.2 options/Each# { |
| 45 | fn fromrust-analyzer cargo derive_builder_core 0.20.2 options/impl#[Each][`From<syn::Ident>`]from().(name: synrust-analyzer cargo syn 2.0.119 crate/::Identrust-analyzer cargo proc-macro2 1.0.107 Ident#) -> Selfrust-analyzer cargo derive_builder_core 0.20.2 options/impl#[Each][`From<syn::Ident>`] { |
| 46 | Selfrust-analyzer cargo derive_builder_core 0.20.2 options/impl#[Each][`From<syn::Ident>`] { namerust-analyzer cargo derive_builder_core 0.20.2 options/Each#name., intorust-analyzer cargo derive_builder_core 0.20.2 options/Each#into.: false } |
| 47 | } |
| 48 | } |