#[optfn]
Expand description
Optional arguments for functions! Add optfn on top of any function and then you can call the funtion with optional arguments.
Note that this still obeys traditional macro_rules, so you can only use the macro after declaration or import it from “crate”.
ⓘ
#[optargs::optfn]
pub fn plot(
x: Vec<i32>,
y: Option<Vec<i32>>,
title: Option<&str>,
xlabel: Option<&str>,
ylabel: Option<&str>,
legend: Option<bool>
) {}
// can now call it with optional arguments
plot!(
x: vec![1,2,3],
y: vec![1,2,3],
title: "Awesome plot",
xlabel: "x axis",
ylabel: "y axis"
);