Named parameters in Rust
(Jin Qing's Column, Nov. 18, 2021)
There is no "named function parameters" in Rust,
but there is an idiom for this case.
If a function needs many parameters, we can define a type
with all these parameters as fields, and implement Default
trait for this type.
Then we can input this type as the function parameter,
with some of the fields specified and others using default.
foo(Config {
a: 123,
b: bool,
...Default::default(),
});