blob: 56d6b198d681f347e4716f7a202874ef16e259b7 (
plain)
# Feluments
A macro to provide optional arguments to Rust.
This crate works by providing a derive macro to implement builders for structs,
and also providing a macro as a shorthand for builders.
```rust
use feluments::*;
#[derive(Debug, PartialEq, Eq, Builder)]
#[builder(vis = pub)]
struct Foo {
#[builder(default = 45)]
x: i32,
#[builder(into)]
y: String,
#[builder(optional)]
z: ()
}
build!(Foo { x: 32, y: "baz" }),
```
The above `build!` macro expands to the following:
```rust
Foo::builder().x(32).y("baz").build()
```
Although this library provides a `Builder` derive macro to make the `build!`
macro work, the `build!` macro is also compatible with other builder crates,
such as [bon](https://bon-rs.com/), [buildstructor](https://crates.io/crates/buildstructor),
or [typed-builder](https://crates.io/crates/typed-builder).
## Contributing
To contribute to this codebase, send your patch file to `botahamec@outlook.com`.
|