Struct derive_builder_core::Setter [−][src]
pub struct Setter<'a> { pub setter_enabled: bool, pub try_setter: bool, pub visibility: Visibility, pub pattern: BuilderPattern, pub attrs: &'a [Attribute], pub ident: Ident, pub field_ident: &'a Ident, pub field_type: &'a Type, pub generic_into: bool, pub strip_option: bool, pub deprecation_notes: &'a DeprecationNotes, pub bindings: Bindings, }
Setter for the struct fields in the build method, implementing
quote::ToTokens
.
Examples
Will expand to something like the following (depending on settings):
pub fn foo(&mut self, value: Foo) -> &mut Self { let mut new = self; new.foo = ::std::option::Option::Some(value); new }
Fields
setter_enabled: bool
Enables code generation for this setter fn.
try_setter: bool
Enables code generation for the try_
variant of this setter fn.
visibility: Visibility
Visibility of the setter, e.g. syn::Visibility::Public
.
pattern: BuilderPattern
How the setter method takes and returns self
(e.g. mutably).
attrs: &'a [Attribute]
Attributes which will be attached to this setter fn.
ident: Ident
Name of this setter fn.
field_ident: &'a Ident
Name of the target field.
field_type: &'a Type
Type of the target field.
The corresonding builder field will be Option<field_type>
.
generic_into: bool
Make the setter generic over Into<T>
, where T
is the field type.
strip_option: bool
Make the setter remove the Option wrapper from the setter, remove the need to call Some(…). when combined with into, the into is used on the content Type of the Option.
deprecation_notes: &'a DeprecationNotes
Emit deprecation notes to the user.
bindings: Bindings
Bindings to libstd or libcore.
Trait Implementations
impl<'a> ToTokens for Setter<'a>
[src]
impl<'a> ToTokens for Setter<'a>
[src]