Anonymous
11/8/2025, 8:50:34 PM
No.107145798
>>107145571
Ah, ok.
>>107145590
Yea, but that's not fun and doesn't play well with function pointers.
For functions that take variable number of arguments, it's more common to use a structs like:
Foo::new(FooConfig {
arg: val,
arg2: val2,
.. Default::default()
})
With #[non_exhaustive] you can leave room for future additions to these arguments. And you can also replace Default::default() with some builder method FooConfig::some_preset() to have various presets of default values that can be further configured via the syntax above.
Ah, ok.
>>107145590
Yea, but that's not fun and doesn't play well with function pointers.
For functions that take variable number of arguments, it's more common to use a structs like:
Foo::new(FooConfig {
arg: val,
arg2: val2,
.. Default::default()
})
With #[non_exhaustive] you can leave room for future additions to these arguments. And you can also replace Default::default() with some builder method FooConfig::some_preset() to have various presets of default values that can be further configured via the syntax above.