Skip to content

Instantly share code, notes, and snippets.

@SiegeLord
Created September 16, 2014 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SiegeLord/84311fbbc8146e0eb5b1 to your computer and use it in GitHub Desktop.
Save SiegeLord/84311fbbc8146e0eb5b1 to your computer and use it in GitHub Desktop.
Keyword arguments!
#![feature(phase)]
#[phase(plugin)]
extern crate kwarg_macros;
kwarg_decl!(foo(a = 1, b = 2, c = 3))
fn foo(a: int, b: int, c: int) -> (int, int, int)
{
(a, b, c)
}
fn main()
{
let ret = foo!(1, c = 5, b = 2);
assert_eq!(ret, (1, 2, 5));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment