optfield
optfield
is a macro that, given a struct, generates another struct with
the same fields, but wrapped in Option<T>
.
Minimum rustc version: 1.56.0
Install
cargo add optfield
Use
optfield
takes the opt struct name as its first argument:
use optfield;
This will generate another struct that looks like:
optfield
supports defining visibility, documentation, attributes and merge
methods. For more details and examples check its documentation.
License
Licensed under either of Apache License, Version 2.0 or MIT at your option.