24
Rust Doesn't Have Named Arguments. So What?
(thoughtbot.com)
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Credits
Another option that the author didn't mention: Newtypes.
There's a pretty neat example for this in Rust By Example: https://doc.rust-lang.org/rust-by-example/generics/new_types.html
If you don't factor out the instantiation of the parameters, you get pretty close to having named parameters, actually:
(Playground)
It is a little bit more work when writing the API, and the caller has to type a tiny bit extra when calling the function, but it also removes all ambiguity regarding the order of the funtion parameters. If also used on the return type, we suddenly get "named" return values too.