use autoargs::{autoargs, default};
struct A(String);
struct B(u32);
struct C(bool);
fn foo() -> A {
A("default_a".to_string())
}
fn bar() -> B {
B(42)
}
fn baz() -> C {
C(true)
}
#[autoargs]
fn draw(
#[default = "foo()"]
a: A,
#[default = "bar()"]
b: B,
#[default = "baz()"]
c: C,
) -> String {
format!("Drawing: a={}, b={}, c={}", a.0, b.0, c.0)
}
fn main() {
let result1 = draw!();
println!("All defaults: {}", result1);
let custom_a = A("custom_a".to_string());
let custom_b = B(100);
let result2 = draw!(
a = custom_a,
b = custom_b,
);
println!("Custom a and b: {}", result2);
let custom_c = C(false);
let result3 = draw!(
c = custom_c,
);
println!("Custom c: {}", result3);
}