scones 0.1.2

Generates simple constructors for structs.
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented1 out of 3 items with examples
  • Size
  • Source code size: 17.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.74 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • someguynamedjosh

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