title: How to best *fake* keyword style function arguments in Rust?
body: <p>I'm interested to have something functionally similar to keyword arguments in Rust, where they're currently not supported.</p>
  
  <p>For languages that provide keyword argument, something like this is common:</p>
  
  <pre><code>panel.button(label="Some Button")
  panel.button(label="Test", align=Center, icon=CIRCLE)
  </code></pre>
  
  <p>I've seen this handled using the builder-pattern, eg:</p>
  
  <pre><code>ui::Button::new().label("Some Button").build(panel)
  ui::Button::new().label("Test").align(Center).icon(CIRCLE).build(panel)
  </code></pre>
  
  <p>Which is fine but at times a little awkward compared with keyword arguments in Python.</p>
  
  <hr>
  
  <p>However using struct initialization with <code>impl Default</code> and <code>Option&lt;..&gt;</code> members in Rust could be used to get something very close to something which is in practice similar to writing keyword arguments, eg:</p>
  
  <pre><code>ui::button(ButtonArgs { label: "Some Button".to_string(), .. Default::default() } );
  
  ui::button(ButtonArgs {
      label: "Test".to_string(),
      align: Some(Center),
      icon: Some(Circle),
      .. Default::default()
  });
  </code></pre>
  
  <p>This works, but has some down-sides in the context of attempting to use as keyword args:</p>
  
  <ul>
  <li>Having to prefix the arguments with the name of the <code>struct</code><br><em>(also needing to explicitly include it in the namespace adds some overhead).</em></li>
  <li>Putting <code>Some(..)</code> around every optional argument is annoying/verbose.</li>
  <li><code>.. Default::default()</code> at the end of every use is a little tedious.</li>
  </ul>
  
  <p>Are there ways to reduce some of these issues, <em>(using macros for example)</em> to make this work more easily as a replacement for keyword access?</p>