mirror of
https://github.com/Noratrieb/badargs.git
synced 2026-01-16 12:45:13 +01:00
improve docs
This commit is contained in:
parent
341b3ae26c
commit
6054c988a0
1 changed files with 16 additions and 13 deletions
|
|
@ -52,21 +52,25 @@ macro_rules! arg {
|
||||||
/// This macro lets you specify your arguments in a flat list, and then converts them into
|
/// This macro lets you specify your arguments in a flat list, and then converts them into
|
||||||
/// nested tuples for you, since that's what's internally used.
|
/// nested tuples for you, since that's what's internally used.
|
||||||
/// ```
|
/// ```
|
||||||
/// # use badargs::arg;
|
/// use badargs::arg;
|
||||||
/// # arg!(Force: "force", 'f' -> bool);
|
/// arg!(Force: "force", 'f' -> bool);
|
||||||
/// # arg!(OutFile: "outfile", 't' -> bool);
|
/// arg!(OutFile: "outfile", 't' -> bool);
|
||||||
/// # arg!(SetUpstream: "set-upstream", 'x' -> bool);
|
/// arg!(SetUpstream: "set-upstream", 'x' -> bool);
|
||||||
/// # fn main() {
|
///
|
||||||
/// let args = badargs::badargs!(Force, OutFile, SetUpstream);
|
/// fn main() {
|
||||||
/// # }
|
/// let args = badargs::badargs!(Force, OutFile, SetUpstream);
|
||||||
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
/// will be expanded into
|
/// will be expanded into
|
||||||
/// ```
|
/// ```
|
||||||
/// # use badargs::arg;
|
/// use badargs::arg;
|
||||||
/// # arg!(Force: "force", 'f' -> bool);
|
/// arg!(Force: "force", 'f' -> bool);
|
||||||
/// # arg!(OutFile: "outfile", 't' -> bool);
|
/// arg!(OutFile: "outfile", 't' -> bool);
|
||||||
/// # arg!(SetUpstream: "set-upstream", 'x' -> bool);
|
/// arg!(SetUpstream: "set-upstream", 'x' -> bool);
|
||||||
/// let args = badargs::badargs::<(Force, (OutFile, SetUpstream))>();
|
///
|
||||||
|
/// fn main() {
|
||||||
|
/// let args = badargs::badargs::<(Force, (OutFile, SetUpstream))>();
|
||||||
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
/// This only provides a minor benefit for programs with a small amount of args, but is
|
/// This only provides a minor benefit for programs with a small amount of args, but is
|
||||||
/// very useful for larger arg amounts.
|
/// very useful for larger arg amounts.
|
||||||
|
|
@ -82,7 +86,6 @@ macro_rules! badargs {
|
||||||
{
|
{
|
||||||
#[allow(unused_parens)] // allow this because there might only be one arg
|
#[allow(unused_parens)] // allow this because there might only be one arg
|
||||||
{
|
{
|
||||||
|
|
||||||
$crate::badargs::<($crate::badargs!(@inner $($tail),+))>()
|
$crate::badargs::<($crate::badargs!(@inner $($tail),+))>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue