Expand description
Scones is a library for generating constructors and builders without the verbosity it usually
requires. See the documentation for #[make_constructor]
to see how to use this system. The
syntax and usage of #[make_builder]
is similar to #[make_constructor]
apart from a few
minor differences. A short example of how this crate works is as follows:
use scones::make_constructor;
#[make_constructor]
#[make_constructor(pub inverse)]
#[make_constructor(pub identity)]
struct MyData {
#[value(1 for identity)]
val1: i32,
#[value(-val1 for inverse)]
#[value(1 for identity)]
val2: i32,
#[value(true)]
always_true: bool
}
let instance = MyData::new(10, 23);
let inverse = MyData::inverse(5);
let identity = MyData::identity();
Documented examples can be found at https://docs.rs/scones_examples
Structs§
- Missing
- Indicates that a particular required value has not been provided yet in a builder.
- Present
- Indicates that a particular required value has been provided in a builder.
Attribute Macros§
- make_
builder - Proc macro to generate builders for structs.
- make_
constructor - Proc macro to generate constructors for structs.