[][src]Struct derive_builder_core::Builder

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<TokenStream>,
    pub functions: Vec<TokenStream>,
    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<TokenStream>

Fields of the builder struct, e.g. foo: u32,

Expects each entry to be terminated by a comma.

functions: Vec<TokenStream>

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]

pub fn doc_comment(&mut self, s: String) -> &mut Self[src]

Set a doc-comment for this item.

pub fn push_field(&mut self, f: BuilderField) -> &mut Self[src]

Add a field to the builder

pub fn push_setter_fn(&mut self, f: Setter) -> &mut Self[src]

Add a setter function to the builder

pub fn push_build_fn(&mut self, f: BuildMethod) -> &mut Self[src]

Add final build function to the builder

Trait Implementations

impl<'a> Debug for Builder<'a>[src]

impl<'a> ToTokens for Builder<'a>[src]

fn into_token_stream(self) -> TokenStream[src]

Convert self directly into a TokenStream object. Read more

Auto Trait Implementations

impl<'a> !Send for Builder<'a>

impl<'a> !Sync for Builder<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Spanned for T where
    T: ToTokens
[src]