Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[non_exhaustive] structs require the use of let mut to specify non-default options #666

Open
42triangles opened this issue Jul 25, 2024 · 1 comment

Comments

@42triangles
Copy link

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?

@sunng87
Copy link
Owner

sunng87 commented Jul 27, 2024

Sounds good to me. Could you please send a pull request for this? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants