handlebars-rust
handlebars-rust copied to clipboard
`#[non_exhaustive]` `struct`s require the use of `let mut` to specify non-default options
Since #647, using non-default values for structs with #[non_exhaustive] (like DirectorySourceOptions for example) requires the use of let mut to store the default value followed by mutating that value, since using functional record updates doesn't work in the presence of #[non_exhaustive].
This isn't an important issue to fix (it's just an added inconvenience I have run into), and having non_exhaustive to be able to more easily update the type is probably worth not supporting the functional record update syntax, but since I haven't seen this being brought up yet I wanted to do so.
Just adding a builder type / functions like fn with_template_extension(self, extension: impl Into<String>) -> Self may potentially be a good idea though?
Sounds good to me. Could you please send a pull request for this? Thank you!
Just ran into this today. I'd love to have some kind of instantiator method/function.