With newtypes you can also emulate named args with a single struct. This also allows them to be passed on together.
struct RectArgs{
x:i32,
y:32,
w:32,
h:32,
}
impl Default for RectArgs{...}
Then the call site looks like this:
rect(RectArgs{
x:0,
y:0,
w:30,
h:20,
}
// with default arguments
rect(RectArgs{
w:30,
h:20,
.. RectArgs::default ()
}





I assumed the rect is a method on something like a graphics context or physics engine, but yeah.