pub trait Buildable: Sized where
    Self: BoulderBase, 
{ type Builder: Builder<Result = Self>; fn builder() -> Self::Builder; }
Expand description

A type that has an associated default Builder.

This trait is implemented via the Buildable derive macro. It cannot be directly implemented because the library itself provides a blanket implementation from a more complex underlying trait MiniBuildable, which is not currently documented.

This restriction may be removed in a future version; much of the complexity in this module stems from lacking generic associated types on stable.

Required Associated Types

A default choice of Builder for this type.

Required Methods

Create a new default builder.

Example

use boulder::{Builder, Buildable};

#[derive(Buildable)]
struct Foo {
   a: i32
}

let b = Foo::builder();
let f = b.build();
assert_eq!(f.a, 0);

Implementors