Struct derive_builder_core::Builder [−][src]
pub struct Builder<'a> {
pub enabled: bool,
pub ident: Ident,
pub pattern: BuilderPattern,
pub derives: &'a [Ident],
pub generics: Option<&'a Generics>,
pub visibility: Visibility,
pub fields: Vec<Tokens>,
pub functions: Vec<Tokens>,
pub must_derive_clone: bool,
pub doc_comment: Option<Attribute>,
pub deprecation_notes: DeprecationNotes,
pub bindings: Bindings,
}Builder, implementing quote::ToTokens.
Examples
Will expand to something like the following (depending on settings):
#[derive(Default, Clone)] pub struct FooBuilder { foo: u32, } #[allow(dead_code)] impl FooBuilder { fn bar () -> { unimplemented!() } }
Fields
enabled: bool
Enables code generation for this builder struct.
ident: Ident
Name of this builder struct.
pattern: BuilderPattern
Pattern of this builder struct.
derives: &'a [Ident]
Traits to automatically derive on the builder type.
generics: Option<&'a Generics>
Type parameters and lifetimes attached to this builder's struct definition.
visibility: Visibility
Visibility of the builder struct, e.g. syn::Visibility::Public.
fields: Vec<Tokens>
Fields of the builder struct, e.g. foo: u32,
Expects each entry to be terminated by a comma.
functions: Vec<Tokens>
Functions of the builder struct, e.g. fn bar() -> { unimplemented!() }
must_derive_clone: bool
Whether this builder must derive Clone.
This is true even for a builder using the owned pattern if there is a field whose setter
uses a different pattern.
doc_comment: Option<Attribute>
Doc-comment of the builder struct.
deprecation_notes: DeprecationNotes
Emit deprecation notes to the user.
bindings: Bindings
Library bindings to use in emitted builder.
Methods
impl<'a> Builder<'a>[src]
impl<'a> Builder<'a>pub fn doc_comment(&mut self, s: String) -> &mut Self[src]
pub fn doc_comment(&mut self, s: String) -> &mut SelfSet a doc-comment for this item.
pub fn push_field(&mut self, f: BuilderField) -> &mut Self[src]
pub fn push_field(&mut self, f: BuilderField) -> &mut SelfAdd a field to the builder
pub fn push_setter_fn(&mut self, f: Setter) -> &mut Self[src]
pub fn push_setter_fn(&mut self, f: Setter) -> &mut SelfAdd a setter function to the builder
pub fn push_build_fn(&mut self, f: BuildMethod) -> &mut Self[src]
pub fn push_build_fn(&mut self, f: BuildMethod) -> &mut SelfAdd final build function to the builder
Trait Implementations
impl<'a> Debug for Builder<'a>[src]
impl<'a> Debug for Builder<'a>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<'a> ToTokens for Builder<'a>[src]
impl<'a> ToTokens for Builder<'a>