[−][src]Struct derive_builder_core::Builder
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 to_tokens(&self, tokens: &mut TokenStream)
[src]
fn into_token_stream(self) -> TokenStream
[src]
Convert self
directly into a TokenStream
object. Read more
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Spanned for T where
T: ToTokens,
[src]
T: ToTokens,