handlebars-rust icon indicating copy to clipboard operation
handlebars-rust copied to clipboard

`#[non_exhaustive]` `struct`s require the use of `let mut` to specify non-default options

Open 42triangles opened this issue 6 months ago • 1 comments

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?

42triangles avatar Jul 25 '24 14:07 42triangles