565 lines
No EOL
49 KiB
HTML
565 lines
No EOL
49 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="generator" content="rustdoc">
|
||
<meta name="description" content="API documentation for the Rust `Arg` struct in crate `clap`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, Arg">
|
||
|
||
<title>clap::Arg - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../main.css">
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'><a href='index.html'>clap</a></p><script>window.sidebarCurrent = {name: 'Arg', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<nav class="sub">
|
||
<form class="search-form js-only">
|
||
<div class="search-container">
|
||
<input class="search-input" name="search"
|
||
autocomplete="off"
|
||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||
type="search">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content struct">
|
||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>Arg</a></span><span class='out-of-band'><span id='render-detail'>
|
||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||
[<span class='inner'>−</span>]
|
||
</a>
|
||
</span><a id='src-2842' class='srclink' href='../src/clap/args/arg.rs.html.html#44-100' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust struct'>pub struct Arg<'n, 'l, 'h, 'g, 'p, 'r> {
|
||
pub name: &'n <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>,
|
||
pub short: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.char.html'>char</a>>,
|
||
pub long: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&'l <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>,
|
||
pub help: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&'h <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>,
|
||
pub required: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>,
|
||
pub takes_value: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>,
|
||
pub index: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>,
|
||
pub multiple: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>,
|
||
pub blacklist: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'r <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>>,
|
||
pub possible_vals: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'p <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>>,
|
||
pub requires: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'r <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>>,
|
||
pub group: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&'g <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>,
|
||
pub val_names: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/btree/set/struct.BTreeSet.html' title='collections::btree::set::BTreeSet'>BTreeSet</a><&'n <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>>,
|
||
pub num_vals: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>,
|
||
pub max_vals: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>,
|
||
pub min_vals: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>>,
|
||
pub empty_vals: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>,
|
||
pub global: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>,
|
||
pub validator: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/alloc/rc/struct.Rc.html' title='alloc::rc::Rc'>Rc</a><<a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Fn.html' title='core::ops::Fn'>Fn</a>(<a class='struct' href='https://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a>) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>, <a class='struct' href='https://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a>>>>,
|
||
pub overrides: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'r <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>>,
|
||
pub hidden: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>,
|
||
}</pre><div class='docblock'><p>The abstract representation of a command line argument used by the consumer of the library.
|
||
Used to set all the options and relationships that define a valid argument for the program.</p>
|
||
|
||
<p>This struct is used by the library consumer and describes the command line arguments for
|
||
their program. Then evaluates the settings the consumer provided and determines the concret
|
||
argument type to use when parsing.</p>
|
||
|
||
<p>There are two methods for constructing <code>Arg</code>s, using the builder pattern and setting options
|
||
manually, or using a usage string which is far less verbose. You can also use a combination
|
||
of the two methods to achieve the best of both worlds.</p>
|
||
|
||
<p>**NOTE*: Fields of this struct are <strong>not</strong> meant to be used directly unless absolutely
|
||
required. 99.9% of the tasks can be performed without accessing these fields directly.</p>
|
||
|
||
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='comment'>// Using the traditional builder pattern and setting each option manually</span>
|
||
<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>"config"</span>)
|
||
.<span class='ident'>short</span>(<span class='string'>"c"</span>)
|
||
.<span class='ident'>long</span>(<span class='string'>"config"</span>)
|
||
.<span class='ident'>takes_value</span>(<span class='boolval'>true</span>)
|
||
.<span class='ident'>help</span>(<span class='string'>"Provides a config file to myprog"</span>)
|
||
<span class='comment'>// Using a usage string (setting a similar argument to the one above)</span>
|
||
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"-i --input=[input] 'Provides an input file to the program'"</span>)</pre>
|
||
</div><h2 class='fields'>Fields</h2>
|
||
<table><tr class='stab '>
|
||
<td id='structfield.name'><code>name</code></td><td><div class='docblock'><p>The unique name of the argument</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.short'><code>short</code></td><td><div class='docblock'><p>The short version (i.e. single character) of the argument, no preceding <code>-</code>
|
||
<strong>NOTE:</strong> <code>short</code> is mutually exclusive with <code>index</code></p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.long'><code>long</code></td><td><div class='docblock'><p>The long version of the flag (i.e. word) without the preceding <code>--</code>
|
||
<strong>NOTE:</strong> <code>long</code> is mutually exclusive with <code>index</code></p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.help'><code>help</code></td><td><div class='docblock'><p>The string of text that will displayed to the user when the application's
|
||
<code>help</code> text is displayed</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.required'><code>required</code></td><td><div class='docblock'><p>If this is a required by default when using the command line program,
|
||
e.g. a configuration file that's required for the program to function
|
||
<strong>NOTE:</strong> required by default means it is required <em>until</em> mutually
|
||
exclusive arguments are evaluated.</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.takes_value'><code>takes_value</code></td><td><div class='docblock'><p>Determines if this argument is an option (as opposed to flag or positional) and
|
||
is mutually exclusive with <code>index</code> and <code>multiple</code></p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.index'><code>index</code></td><td><div class='docblock'><p>The index of the argument. <code>index</code> is mutually exclusive with <code>takes_value</code>
|
||
and <code>multiple</code></p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.multiple'><code>multiple</code></td><td><div class='docblock'><p>Determines if multiple instances of the same flag are allowed. <code>multiple</code>
|
||
is mutually exclusive with <code>index</code>.
|
||
e.g. <code>-v -v -v</code> or <code>-vvv</code> or <code>--option foo --option bar</code></p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.blacklist'><code>blacklist</code></td><td><div class='docblock'><p>A list of names for other arguments that <em>may not</em> be used with this flag</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.possible_vals'><code>possible_vals</code></td><td><div class='docblock'><p>A list of possible values for an option or positional argument</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.requires'><code>requires</code></td><td><div class='docblock'><p>A list of names of other arguments that are <em>required</em> to be used when
|
||
this flag is used</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.group'><code>group</code></td><td><div class='docblock'><p>A name of the group the argument belongs to</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.val_names'><code>val_names</code></td><td><div class='docblock'><p>A set of names (ordered) for the values to be displayed with the help message</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.num_vals'><code>num_vals</code></td><td><div class='docblock'><p>The exact number of values to satisfy this argument</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.max_vals'><code>max_vals</code></td><td><div class='docblock'><p>The maximum number of values possible for this argument</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.min_vals'><code>min_vals</code></td><td><div class='docblock'><p>The minimum number of values possible to satisfy this argument</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.empty_vals'><code>empty_vals</code></td><td><div class='docblock'><p>Specifies whether or not this argument accepts explicit empty values such as <code>--option ""</code></p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.global'><code>global</code></td><td><div class='docblock'><p>Specifies whether or not this argument is global and should be propagated through all
|
||
child subcommands</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.validator'><code>validator</code></td><td><div class='docblock'><p>A function used to check the validity of an argument value. Failing this validation results
|
||
in failed argument parsing.</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.overrides'><code>overrides</code></td><td><div class='docblock'><p>A list of names for other arguments that <em>mutually override</em> this flag</p>
|
||
</div></td></tr><tr class='stab '>
|
||
<td id='structfield.hidden'><code>hidden</code></td><td><div class='docblock'><p>Specifies whether the argument should show up in the help message</p>
|
||
</div></td></tr></table><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl<'n, 'l, 'h, 'g, 'p, 'r> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h3><div class='impl-items'><h4 id='method.with_name' class='method'><code>fn <a href='#method.with_name' class='fnname'>with_name</a>(n: &'n <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Creates a new instance of <code>Arg</code> using a unique string name.
|
||
The name will be used by the library consumer to get information about
|
||
whether or not the argument was used at runtime.</p>
|
||
|
||
<p><strong>NOTE:</strong> in the case of arguments that take values (i.e. <code>takes_value(true)</code>)
|
||
and positional arguments (i.e. those without a <code>-</code> or <code>--</code>) the name will also
|
||
be displayed when the user prints the usage/help information of the program.</p>
|
||
|
||
<h1 id='examples-1' class='section-header'><a href='#examples-1'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>"config"</span>)</pre>
|
||
</div><h4 id='method.from_usage' class='method'><code>fn <a href='#method.from_usage' class='fnname'>from_usage</a>(u: &'n <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'n, 'n, 'g, 'p, 'r></code></h4>
|
||
<div class='docblock'><p>Creates a new instance of <code>Arg</code> from a usage string. Allows creation of basic settings
|
||
for Arg (i.e. everything except relational rules). The syntax is flexible, but there are
|
||
some rules to follow.</p>
|
||
|
||
<p><strong>NOTE</strong>: only properties which you wish to set must be present</p>
|
||
|
||
<ol>
|
||
<li>Name (arguments with a <code>long</code> or that take a value can omit this if desired),
|
||
use <code>[]</code> for non-required arguments, or <code><></code> for required arguments.</li>
|
||
<li>Short preceded by a <code>-</code></li>
|
||
<li>Long preceded by a <code>--</code> (this may be used as the name, if the name is omitted. If the
|
||
name is <em>not</em> omitted, the name takes precedence over the <code>long</code>)</li>
|
||
<li>Value (this can be used as the name if the name is not manually specified. If the name
|
||
is manually specified, it takes precedence. If this value is used as the name, it uses
|
||
the same <code>[]</code> and <code><></code> requirement specification rules. If it is <em>not</em> used as the name,
|
||
it still needs to be surrounded by either <code>[]</code> or <code><></code> but there is no requirement
|
||
effect, as the requirement rule is determined by the real name. This value may follow
|
||
the <code>short</code> or <code>long</code>, it doesn't matter. If it follows the <code>long</code>, it may follow either
|
||
a <code>=</code> or <code></code> there is no difference, just personal preference. If this follows a <code>short</code>
|
||
it can only be after a <code></code>) i.e. <code>-c [name]</code>, <code>--config [name]</code>, <code>--config=[name]</code>, etc.</li>
|
||
<li>Multiple specifier <code>...</code> (the <code>...</code> may follow the name, <code>short</code>, <code>long</code>, or value
|
||
<em>without</em> a <code></code> space) i.e. <code><name>... -c</code>, <code>--config <name>...</code>, <code>[name] -c...</code>, etc.</li>
|
||
<li>The help info surrounded by <code>'</code>s (single quotes)</li>
|
||
<li>The index of a positional argument will be the next available index (you don't need to
|
||
specify one) i.e. all arguments without a <code>short</code> or <code>long</code> will be treated as
|
||
positional</li>
|
||
<li>If the value names are all the same, and their multiple ones (i.e <code>-o <val> <val></code>)
|
||
they are counted and used as the number of values. If they are different, they are used
|
||
as the value names (i.e. <code>--opt <file> <mode></code>). In this case, if no name was specified
|
||
prior to the value names, the long is used as the name by which to access the argument.</li>
|
||
</ol>
|
||
|
||
<h1 id='examples-2' class='section-header'><a href='#examples-2'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>args</span>(<span class='macro'>vec</span><span class='macro'>!</span>[
|
||
|
||
<span class='comment'>// A option argument with a long, named "conf" (note: because the name was specified</span>
|
||
<span class='comment'>// the portion after the long can be called anything, only the first name will be displayed</span>
|
||
<span class='comment'>// to the user. Also, requirement is set with the *name*, so the portion after the long</span>
|
||
<span class='comment'>// could be either <> or [] and it wouldn't matter, so long as it's one of them. Had the</span>
|
||
<span class='comment'>// name been omitted, the name would have been derived from the portion after the long and</span>
|
||
<span class='comment'>// those rules would have mattered)</span>
|
||
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"[conf] --config=[c] 'a required file for the configuration'"</span>),
|
||
|
||
<span class='comment'>// A flag with a short, a long, named "debug", and accepts multiple values</span>
|
||
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"-d --debug... 'turns on debugging information"</span>),
|
||
|
||
<span class='comment'>// A required positional argument named "input"</span>
|
||
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"<input> 'the input file to use'"</span>)
|
||
])</pre>
|
||
</div><h4 id='method.short' class='method'><code>fn <a href='#method.short' class='fnname'>short</a>(self, s: &<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Sets the short version of the argument without the preceding <code>-</code>.</p>
|
||
|
||
<p>By default <code>clap</code> automatically assigns <code>V</code> and <code>h</code> to display version and help information
|
||
respectively. You may use <code>V</code> or <code>h</code> for your own purposes, in which case <code>clap</code> simply
|
||
will not assign those to the displaying of version or help.</p>
|
||
|
||
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped, and only the first
|
||
non <code>-</code> character will be used as the <code>short</code> version</p>
|
||
|
||
<h1 id='examples-3' class='section-header'><a href='#examples-3'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>short</span>(<span class='string'>"c"</span>)</pre>
|
||
</div><h4 id='method.long' class='method'><code>fn <a href='#method.long' class='fnname'>long</a>(self, l: &'l <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Sets the long version of the argument without the preceding <code>--</code>.</p>
|
||
|
||
<p>By default <code>clap</code> automatically assigns <code>version</code> and <code>help</code> to display version and help
|
||
information respectively. You may use <code>version</code> or <code>help</code> for your own purposes, in which
|
||
case <code>clap</code> simply will not assign those to the displaying of version or help automatically,
|
||
and you will have to do so manually.</p>
|
||
|
||
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped</p>
|
||
|
||
<h1 id='examples-4' class='section-header'><a href='#examples-4'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>long</span>(<span class='string'>"config"</span>)</pre>
|
||
</div><h4 id='method.help' class='method'><code>fn <a href='#method.help' class='fnname'>help</a>(self, h: &'h <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Sets the help text of the argument that will be displayed to the user
|
||
when they print the usage/help information.</p>
|
||
|
||
<h1 id='examples-5' class='section-header'><a href='#examples-5'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>help</span>(<span class='string'>"The config file used by the myprog"</span>)</pre>
|
||
</div><h4 id='method.required' class='method'><code>fn <a href='#method.required' class='fnname'>required</a>(self, r: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Sets whether or not the argument is required by default. Required by
|
||
default means it is required, when no other mutually exclusive rules have
|
||
been evaluated. Mutually exclusive rules take precedence over being required
|
||
by default.</p>
|
||
|
||
<p><strong>NOTE:</strong> Flags (i.e. not positional, or arguments that take values)
|
||
cannot be required by default.
|
||
when they print the usage/help information.</p>
|
||
|
||
<h1 id='example' class='section-header'><a href='#example'>Example</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>required</span>(<span class='boolval'>true</span>)</pre>
|
||
</div><h4 id='method.conflicts_with' class='method'><code>fn <a href='#method.conflicts_with' class='fnname'>conflicts_with</a>(self, name: &'r <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Sets a mutually exclusive argument by name. I.e. when using this argument,
|
||
the following argument can't be present.</p>
|
||
|
||
<p><strong>NOTE:</strong> Mutually exclusive rules take precedence over being required
|
||
by default. Mutually exclusive rules only need to be set for one of the two
|
||
arguments, they do not need to be set for each.</p>
|
||
|
||
<h1 id='examples-6' class='section-header'><a href='#examples-6'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>conflicts_with</span>(<span class='string'>"debug"</span>)</pre>
|
||
</div><h4 id='method.conflicts_with_all' class='method'><code>fn <a href='#method.conflicts_with_all' class='fnname'>conflicts_with_all</a><T, I>(self, names: I) -> Self <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>> + 'r, I: <a class='trait' href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html' title='core::iter::IntoIterator'>IntoIterator</a><Item=&'r T></span></code></h4>
|
||
<div class='docblock'><p>Sets mutually exclusive arguments by names. I.e. when using this argument,
|
||
the following argument can't be present.</p>
|
||
|
||
<p><strong>NOTE:</strong> Mutually exclusive rules take precedence over being required
|
||
by default. Mutually exclusive rules only need to be set for one of the two
|
||
arguments, they do not need to be set for each.</p>
|
||
|
||
<h1 id='examples-7' class='section-header'><a href='#examples-7'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='ident'>config_conflicts</span> <span class='op'>=</span> [<span class='string'>"debug"</span>, <span class='string'>"input"</span>];
|
||
.<span class='ident'>conflicts_with_all</span>(<span class='kw-2'>&</span><span class='ident'>config_conflicts</span>)</pre>
|
||
</div><h4 id='method.mutually_overrides_with' class='method'><code>fn <a href='#method.mutually_overrides_with' class='fnname'>mutually_overrides_with</a>(self, name: &'r <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Sets a mutually overridable argument by name. I.e. this argument and
|
||
the following argument will override each other in POSIX style</p>
|
||
|
||
<h1 id='examples-8' class='section-header'><a href='#examples-8'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>mutually_overrides_with</span>(<span class='string'>"debug"</span>)</pre>
|
||
</div><h4 id='method.mutually_overrides_with_all' class='method'><code>fn <a href='#method.mutually_overrides_with_all' class='fnname'>mutually_overrides_with_all</a><T, I>(self, names: I) -> Self <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>> + 'r, I: <a class='trait' href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html' title='core::iter::IntoIterator'>IntoIterator</a><Item=&'r T></span></code></h4>
|
||
<div class='docblock'><p>Sets a mutually overridable arguments by name. I.e. this argument and
|
||
the following argument will override each other in POSIX style</p>
|
||
|
||
<h1 id='examples-9' class='section-header'><a href='#examples-9'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='ident'>config_overrides</span> <span class='op'>=</span> [<span class='string'>"debug"</span>, <span class='string'>"input"</span>];
|
||
.<span class='ident'>mutually_overrides_with_all</span>(<span class='kw-2'>&</span><span class='ident'>config_overrides</span>)</pre>
|
||
</div><h4 id='method.requires' class='method'><code>fn <a href='#method.requires' class='fnname'>requires</a>(self, name: &'r <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Sets an argument by name that is required when this one is present I.e. when
|
||
using this argument, the following argument <em>must</em> be present.</p>
|
||
|
||
<p><strong>NOTE:</strong> Mutually exclusive and override rules take precedence over being required</p>
|
||
|
||
<h1 id='examples-10' class='section-header'><a href='#examples-10'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>requires</span>(<span class='string'>"debug"</span>)</pre>
|
||
</div><h4 id='method.requires_all' class='method'><code>fn <a href='#method.requires_all' class='fnname'>requires_all</a><T, I>(self, names: I) -> Self <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>> + 'r, I: <a class='trait' href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html' title='core::iter::IntoIterator'>IntoIterator</a><Item=&'r T></span></code></h4>
|
||
<div class='docblock'><p>Sets arguments by names that are required when this one is present I.e. when
|
||
using this argument, the following arguments <em>must</em> be present.</p>
|
||
|
||
<p><strong>NOTE:</strong> Mutually exclusive and override rules take precedence over being required
|
||
by default.</p>
|
||
|
||
<h1 id='examples-11' class='section-header'><a href='#examples-11'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='ident'>config_reqs</span> <span class='op'>=</span> [<span class='string'>"debug"</span>, <span class='string'>"input"</span>];
|
||
.<span class='ident'>requires_all</span>(<span class='kw-2'>&</span><span class='ident'>config_reqs</span>)</pre>
|
||
</div><h4 id='method.takes_value' class='method'><code>fn <a href='#method.takes_value' class='fnname'>takes_value</a>(self, tv: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies that the argument takes an additional value at run time.</p>
|
||
|
||
<p><strong>NOTE:</strong> When setting this to <code>true</code> the <code>name</code> of the argument
|
||
will be used when printing the help/usage information to the user.</p>
|
||
|
||
<h1 id='examples-12' class='section-header'><a href='#examples-12'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>takes_value</span>(<span class='boolval'>true</span>)</pre>
|
||
</div><h4 id='method.index' class='method'><code>fn <a href='#method.index' class='fnname'>index</a>(self, idx: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies the index of a positional argument starting at 1.</p>
|
||
|
||
<p><strong>NOTE:</strong> When setting this, any <code>short</code> or <code>long</code> values you set
|
||
are ignored as positional arguments cannot have a <code>short</code> or <code>long</code>.
|
||
Also, the name will be used when printing the help/usage information
|
||
to the user.</p>
|
||
|
||
<h1 id='examples-13' class='section-header'><a href='#examples-13'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>index</span>(<span class='number'>1</span>)</pre>
|
||
</div><h4 id='method.multiple' class='method'><code>fn <a href='#method.multiple' class='fnname'>multiple</a>(self, multi: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies that the flag or option may appear more than once. For flags, this results
|
||
in the number of occurrences of the flag being recorded. For example <code>-ddd</code> would count as
|
||
three occurrences. The form <code>-d -d -d</code> would also be recognized as three occurrences. For
|
||
options, more than one value may be provided. The forms <code>--optional foo --optional bar</code>,
|
||
<code>--optional foo bar</code> and <code>-ofoo -obar</code> are all recognized, assuming the relevant <code>short</code>
|
||
and <code>long</code> option names have been set.</p>
|
||
|
||
<p><strong>NOTE:</strong> When setting this, <code>index</code> is ignored as it only makes sense for positional
|
||
arguments.</p>
|
||
|
||
<h1 id='examples-14' class='section-header'><a href='#examples-14'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>multiple</span>(<span class='boolval'>true</span>)</pre>
|
||
</div><h4 id='method.global' class='method'><code>fn <a href='#method.global' class='fnname'>global</a>(self, g: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies that an argument can be matched to all child subcommands.</p>
|
||
|
||
<p><strong>NOTE:</strong> Global arguments <em>only</em> propagate down, <strong>not</strong> up (to parent commands)</p>
|
||
|
||
<p><strong>NOTE:</strong> Global arguments <em>cannot</em> be required.</p>
|
||
|
||
<p><strong>NOTE:</strong> Global arguments, when matched, <em>only</em> exist in the command's matches that they
|
||
were matched to. For example, if you defined a <code>--flag</code> global argument in the top most
|
||
parent command, but the user supplied the arguments <code>top cmd1 cmd2 --flag</code> <em>only</em> <code>cmd2</code>'s
|
||
<code>ArgMatches</code> would return <code>true</code> if tested for <code>.is_present("flag")</code>.</p>
|
||
|
||
<h1 id='examples-15' class='section-header'><a href='#examples-15'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>global</span>(<span class='boolval'>true</span>)</pre>
|
||
</div><h4 id='method.empty_values' class='method'><code>fn <a href='#method.empty_values' class='fnname'>empty_values</a>(self, ev: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Allows an argument to accept explicit empty values. An empty value must be specified at the
|
||
command line with an explicit <code>""</code>, or <code>''</code></p>
|
||
|
||
<p><strong>NOTE:</strong> Defaults to <code>true</code> (Explicit empty values are allowed)</p>
|
||
|
||
<h1 id='examples-16' class='section-header'><a href='#examples-16'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>empty_values</span>(<span class='boolval'>true</span>)</pre>
|
||
</div><h4 id='method.hidden' class='method'><code>fn <a href='#method.hidden' class='fnname'>hidden</a>(self, h: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Hides an argument from help message output.</p>
|
||
|
||
<p><strong>NOTE:</strong> This does <strong>not</strong> hide the argument from usage strings on error</p>
|
||
|
||
<h1 id='examples-17' class='section-header'><a href='#examples-17'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>hidden</span>(<span class='boolval'>true</span>)</pre>
|
||
</div><h4 id='method.possible_values' class='method'><code>fn <a href='#method.possible_values' class='fnname'>possible_values</a><T, I>(self, names: I) -> Self <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>> + 'p, I: <a class='trait' href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html' title='core::iter::IntoIterator'>IntoIterator</a><Item=&'p T></span></code></h4>
|
||
<div class='docblock'><p>Specifies a list of possible values for this argument. At runtime, clap verifies that only
|
||
one of the specified values was used, or fails with a usage string.</p>
|
||
|
||
<p><strong>NOTE:</strong> This setting only applies to options and positional arguments</p>
|
||
|
||
<h1 id='examples-18' class='section-header'><a href='#examples-18'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='ident'>mode_vals</span> <span class='op'>=</span> [<span class='string'>"fast"</span>, <span class='string'>"slow"</span>];
|
||
.<span class='ident'>possible_values</span>(<span class='kw-2'>&</span><span class='ident'>mode_vals</span>)</pre>
|
||
</div><h4 id='method.possible_value' class='method'><code>fn <a href='#method.possible_value' class='fnname'>possible_value</a>(self, name: &'p <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies a possible value for this argument. At runtime, clap verifies that only
|
||
one of the specified values was used, or fails with a usage string.</p>
|
||
|
||
<p><strong>NOTE:</strong> This setting only applies to options and positional arguments</p>
|
||
|
||
<h1 id='examples-19' class='section-header'><a href='#examples-19'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>possible_value</span>(<span class='string'>"fast"</span>)
|
||
.<span class='ident'>possible_value</span>(<span class='string'>"slow"</span>)</pre>
|
||
</div><h4 id='method.group' class='method'><code>fn <a href='#method.group' class='fnname'>group</a>(self, name: &'g <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies the name of the group the argument belongs to.</p>
|
||
|
||
<h1 id='examples-20' class='section-header'><a href='#examples-20'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>group</span>(<span class='string'>"mode"</span>)</pre>
|
||
</div><h4 id='method.number_of_values' class='method'><code>fn <a href='#method.number_of_values' class='fnname'>number_of_values</a>(self, qty: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies how many values are required to satisfy this argument. For example, if you had a
|
||
<code>-f <file></code> argument where you wanted exactly 3 'files' you would set
|
||
<code>.number_of_values(3)</code>, and this argument wouldn't be satisfied unless the user provided
|
||
3 and only 3 values.</p>
|
||
|
||
<p><strong>NOTE:</strong> Does <em>not</em> require <code>.multiple(true)</code> to be set. Setting <code>.multiple(true)</code> would
|
||
allow <code>-f <file> <file> <file> -f <file> <file> <file></code> where as <em>not</em> setting
|
||
<code>.multiple(true)</code> would only allow one occurrence of this argument.</p>
|
||
|
||
<h1 id='examples-21' class='section-header'><a href='#examples-21'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>number_of_values</span>(<span class='number'>3</span>)</pre>
|
||
</div><h4 id='method.validator' class='method'><code>fn <a href='#method.validator' class='fnname'>validator</a><F>(self, f: F) -> Self <span class='where'>where F: <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Fn.html' title='core::ops::Fn'>Fn</a>(<a class='struct' href='https://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a>) -> <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>, <a class='struct' href='https://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a>> + 'static</span></code></h4>
|
||
<div class='docblock'><p>Allows one to perform a validation on the argument value. You provide a closure which
|
||
accepts a <code>String</code> value, a <code>Result</code> where the <code>Err(String)</code> is a message displayed to the
|
||
user.</p>
|
||
|
||
<p><strong>NOTE:</strong> The error message does <em>not</em> need to contain the <code>error:</code> portion, only the
|
||
message.</p>
|
||
|
||
<p><strong>NOTE:</strong> There is a small performance hit for using validators, as they are implemented
|
||
with <code>Rc</code> pointers. And the value to be checked will be allocated an extra time in order to
|
||
to be passed to the closure.</p>
|
||
|
||
<h1 id='examples-22' class='section-header'><a href='#examples-22'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>validator</span>(<span class='op'>|</span><span class='ident'>val</span><span class='op'>|</span> {
|
||
<span class='kw'>if</span> <span class='ident'>val</span>.<span class='ident'>contains</span>(<span class='string'>"@"</span>) {
|
||
<span class='prelude-val'>Ok</span>(())
|
||
} <span class='kw'>else</span> {
|
||
<span class='prelude-val'>Err</span>(<span class='ident'>String</span>::<span class='ident'>from</span>(<span class='string'>"the value must contain at least one '@' character"</span>))
|
||
}
|
||
})</pre>
|
||
</div><h4 id='method.max_values' class='method'><code>fn <a href='#method.max_values' class='fnname'>max_values</a>(self, qty: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies the <em>maximum</em> number of values are for this argument. For example, if you had a
|
||
<code>-f <file></code> argument where you wanted up to 3 'files' you would set
|
||
<code>.max_values(3)</code>, and this argument would be satisfied if the user provided, 1, 2, or 3
|
||
values.</p>
|
||
|
||
<p><strong>NOTE:</strong> <code>qty</code> must be > 1</p>
|
||
|
||
<p><strong>NOTE:</strong> This implicitly sets <code>.multiple(true)</code></p>
|
||
|
||
<h1 id='examples-23' class='section-header'><a href='#examples-23'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>max_values</span>(<span class='number'>3</span>)</pre>
|
||
</div><h4 id='method.min_values' class='method'><code>fn <a href='#method.min_values' class='fnname'>min_values</a>(self, qty: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies the <em>minimum</em> number of values are for this argument. For example, if you had a
|
||
<code>-f <file></code> argument where you wanted at least 2 'files' you would set
|
||
<code>.min_values(2)</code>, and this argument would be satisfied if the user provided, 2 or more
|
||
values.</p>
|
||
|
||
<p><strong>NOTE:</strong> This implicitly sets <code>.multiple(true)</code></p>
|
||
|
||
<p><strong>NOTE:</strong> <code>qty</code> must be > 0</p>
|
||
|
||
<p><strong>NOTE:</strong> <code>qty</code> <em>must</em> be > 0. If you wish to have an argument with 0 or more values prefer
|
||
two separate arguments (a flag, and an option with multiple values).</p>
|
||
|
||
<h1 id='examples-24' class='section-header'><a href='#examples-24'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
.<span class='ident'>min_values</span>(<span class='number'>2</span>)</pre>
|
||
</div><h4 id='method.value_names' class='method'><code>fn <a href='#method.value_names' class='fnname'>value_names</a><T, I>(self, names: I) -> Self <span class='where'>where T: <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>> + 'n, I: <a class='trait' href='https://doc.rust-lang.org/nightly/core/iter/trait.IntoIterator.html' title='core::iter::IntoIterator'>IntoIterator</a><Item=&'n T></span></code></h4>
|
||
<div class='docblock'><p>Specifies names for values of option arguments. These names are cosmetic only, used for
|
||
help and usage strings only. The names are <strong>not</strong> used to access arguments. The values of
|
||
the arguments are accessed in numeric order (i.e. if you specify two names <code>one</code> and <code>two</code>
|
||
<code>one</code> will be the first matched value, <code>two</code> will be the second).</p>
|
||
|
||
<p><strong>NOTE:</strong> This implicitly sets <code>.number_of_values()</code> so there is no need to set that, but
|
||
be aware that the number of "names" you set for the values, will be the <em>exact</em> number of
|
||
values required to satisfy this argument</p>
|
||
|
||
<p><strong>NOTE:</strong> Does <em>not</em> require <code>.multiple(true)</code> to be set. Setting <code>.multiple(true)</code> would
|
||
allow <code>-f <file> <file> <file> -f <file> <file> <file></code> where as <em>not</em> setting
|
||
<code>.multiple(true)</code> would only allow one occurrence of this argument.</p>
|
||
|
||
<h1 id='examples-25' class='section-header'><a href='#examples-25'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>let</span> <span class='ident'>val_names</span> <span class='op'>=</span> [<span class='string'>"one"</span>, <span class='string'>"two"</span>];
|
||
<span class='comment'>// ...</span>
|
||
.<span class='ident'>value_names</span>(<span class='kw-2'>&</span><span class='ident'>val_names</span>)</pre>
|
||
</div><h4 id='method.value_name' class='method'><code>fn <a href='#method.value_name' class='fnname'>value_name</a>(self, name: &'n <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> Self</code></h4>
|
||
<div class='docblock'><p>Specifies the name for value of option or positional arguments. This name is cosmetic only,
|
||
used for help and usage strings. The name is <strong>not</strong> used to access arguments.</p>
|
||
|
||
<h1 id='examples-26' class='section-header'><a href='#examples-26'>Examples</a></h1>
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>"debug"</span>)
|
||
.<span class='ident'>index</span>(<span class='number'>1</span>)
|
||
.<span class='ident'>value_name</span>(<span class='string'>"file"</span>)</pre>
|
||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl<'n, 'l, 'h, 'g, 'p, 'r, 'z> <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html' title='core::convert::From'>From</a><&'z <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r>> for <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h3><div class='impl-items'><h4 id='method.from' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#method.from' class='fnname'>from</a>(a: &'z <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r>) -> Self</code></h4>
|
||
</div><h3 id='derived_implementations'>Derived Implementations </h3><h3 class='impl'><code>impl<'n, 'l, 'h, 'g, 'p, 'r> <a class='trait' href='https://doc.rust-lang.org/nightly/core/default/trait.Default.html' title='core::default::Default'>Default</a> for <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h3><div class='impl-items'><h4 id='method.default' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/default/trait.Default.html#method.default' class='fnname'>default</a>() -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||
</div></section>
|
||
<section id='search' class="content hidden"></section>
|
||
|
||
<section class="footer"></section>
|
||
|
||
<aside id="help" class="hidden">
|
||
<div>
|
||
<h1 class="hidden">Help</h1>
|
||
|
||
<div class="shortcuts">
|
||
<h2>Keyboard Shortcuts</h2>
|
||
|
||
<dl>
|
||
<dt>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</dd>
|
||
</dl>
|
||
</div>
|
||
|
||
<div class="infos">
|
||
<h2>Search Tricks</h2>
|
||
|
||
<p>
|
||
Prefix searches with a type followed by a colon (e.g.
|
||
<code>fn:</code>) to restrict the search to a given type.
|
||
</p>
|
||
|
||
<p>
|
||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||
<code>struct</code>, <code>enum</code>,
|
||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||
and <code>const</code>.
|
||
</p>
|
||
|
||
<p>
|
||
Search functions by type signature (e.g.
|
||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../";
|
||
window.currentCrate = "clap";
|
||
window.playgroundUrl = "";
|
||
</script>
|
||
<script src="../jquery.js"></script>
|
||
<script src="../main.js"></script>
|
||
|
||
<script defer src="../search-index.js"></script>
|
||
</body>
|
||
</html> |