## Overview This is just a little fun project and should probably not be used in production. Currently variadics are only implemented up to a dimension of `4`. `Variadic`'s are only pssible because of default types and I consider this implementaion a `hack`. `Variadic` is the trait that makes variadic arguments possible in stable Rust. `VarArgs1`, `VarArgs2` etc implement `Variadic` which allows the user the call `pop()`. `pop` will return the first argument inside an `Option` and another `VarArgs(n-1)`. For example ~~~ let (Some(value), rest: VarArgs2) = VarArgs3(1, 2, 3).pop(); ~~~ ## Examples: A simple sum example implemented with recursion. ~~~ fn sum>(args: Args) -> i32 { if let (Some(front), rest) = args.pop() { front + sum(rest) } else { 0 } } println!("sum: {}", sum(VarArgs4(1, 2, 3, 4))); ~~~ Here we call `pop` on `VarArgsN` and it will return `(Option, VarArgs(N-1))`. The recursion stops at `VarArgs0` which will returns a `(Option, VarArgs0)` where `Option` will always be `None`. ~~~ fn fact>(args: Args) -> i32 { if let (Some(front), rest) = args.pop() { front * fact(rest) } else { 1 } } println!("fact: {}", fact(VarArgs4(1, 2, 3, 4))); ~~~ It is also possible to use traits with `Variadic`. Here we constrain `T` with `std::fmt::Debug`, then we print out every value that we `pop` off until we reach `VarArgs0`. ~~~ fn debug_print>(args: Args) where T: std::fmt::Debug { if let (Some(front), rest) = args.pop() { println!("{:?}", front); debug_print(rest); } } debug_print(VarArgs3(1, 2, 3)); ~~~