Default Struct Builder
Generates builder methods of every field of a struct. It is meant to be used on structs that
implement Default
. There is no separate builder struct generated and no need to call a
build()
method at the end or .unwrap()
.
This crate is used by the crate leptos-use
for the option structs that
can be passed to the various functions.
Installation
In your project folder run
Usage
It is very easy to use:
use DefaultBuilder;
you can then use the struct like this:
let options = default.offset;
assert_eq!;
assert_eq!;
assert_eq!;
How it works
The derive macro generates the following code:
Related Work
For more general purposes please check out the much more powerful
derive_builder
crate.