wasmer/rustdoc/clap/struct.App.html
2019-09-16 15:54:50 -07:00

729 lines
129 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 `App` struct in crate `clap`."><meta name="keywords" content="rust, rustlang, rust-lang, App"><title>clap::App - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../clap/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Struct App</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.about">about</a><a href="#method.after_help">after_help</a><a href="#method.alias">alias</a><a href="#method.aliases">aliases</a><a href="#method.arg">arg</a><a href="#method.arg_from_usage">arg_from_usage</a><a href="#method.args">args</a><a href="#method.args_from_usage">args_from_usage</a><a href="#method.author">author</a><a href="#method.before_help">before_help</a><a href="#method.bin_name">bin_name</a><a href="#method.display_order">display_order</a><a href="#method.gen_completions">gen_completions</a><a href="#method.gen_completions_to">gen_completions_to</a><a href="#method.get_bin_name">get_bin_name</a><a href="#method.get_matches">get_matches</a><a href="#method.get_matches_from">get_matches_from</a><a href="#method.get_matches_from_safe">get_matches_from_safe</a><a href="#method.get_matches_from_safe_borrow">get_matches_from_safe_borrow</a><a href="#method.get_matches_safe">get_matches_safe</a><a href="#method.get_name">get_name</a><a href="#method.global_setting">global_setting</a><a href="#method.global_settings">global_settings</a><a href="#method.group">group</a><a href="#method.groups">groups</a><a href="#method.help">help</a><a href="#method.help_message">help_message</a><a href="#method.help_short">help_short</a><a href="#method.long_about">long_about</a><a href="#method.long_version">long_version</a><a href="#method.max_term_width">max_term_width</a><a href="#method.name">name</a><a href="#method.new">new</a><a href="#method.print_help">print_help</a><a href="#method.print_long_help">print_long_help</a><a href="#method.set_term_width">set_term_width</a><a href="#method.setting">setting</a><a href="#method.settings">settings</a><a href="#method.subcommand">subcommand</a><a href="#method.subcommands">subcommands</a><a href="#method.template">template</a><a href="#method.unset_setting">unset_setting</a><a href="#method.unset_settings">unset_settings</a><a href="#method.usage">usage</a><a href="#method.version">version</a><a href="#method.version_message">version_message</a><a href="#method.version_short">version_short</a><a href="#method.visible_alias">visible_alias</a><a href="#method.visible_aliases">visible_aliases</a><a href="#method.with_defaults">with_defaults</a><a href="#method.write_help">write_help</a><a href="#method.write_long_help">write_long_help</a><a href="#method.write_long_version">write_long_version</a><a href="#method.write_version">write_version</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Display">Display</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='index.html'>clap</a></p><script>window.sidebarCurrent = {name: 'App', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><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'>&#x2212;</span>]</a></span><a class='srclink' href='../src/clap/app/mod.rs.html#60-65' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class="struct" href=''>App</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct App&lt;'a, 'b&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;'a: 'b,&nbsp;</span> { /* fields omitted */ }</pre></div><div class='docblock'><p>Used to create a representation of a command line program and all possible command line
arguments. Application settings are set using the &quot;builder pattern&quot; with the
<a href="./struct.App.html#method.get_matches"><code>App::get_matches</code></a> family of methods being the terminal methods that starts the
runtime-parsing process. These methods then return information about the user supplied
arguments (or lack there of).</p>
<p><strong>NOTE:</strong> There aren't any mandatory &quot;options&quot; that one must set. The &quot;options&quot; may
also appear in any order (so long as one of the <a href="./struct.App.html#method.get_matches"><code>App::get_matches</code></a> methods is the last method
called).</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;My Program&quot;</span>)
.<span class="ident">author</span>(<span class="string">&quot;Me, me@mail.com&quot;</span>)
.<span class="ident">version</span>(<span class="string">&quot;1.0.2&quot;</span>)
.<span class="ident">about</span>(<span class="string">&quot;Explains in brief what the program does&quot;</span>)
.<span class="ident">arg</span>(
<span class="ident">Arg</span>::<span class="ident">with_name</span>(<span class="string">&quot;in_file&quot;</span>).<span class="ident">index</span>(<span class="number">1</span>)
)
.<span class="ident">after_help</span>(<span class="string">&quot;Longer explanation to appear after the options when \
displaying the help information from --help or -h&quot;</span>)
.<span class="ident">get_matches</span>();
<span class="comment">// Your program logic starts here...</span></pre></div>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl&lt;'a, 'b&gt; <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</code><a href='#impl' class='anchor'></a><a class='srclink' href='../src/clap/app/mod.rs.html#68-1638' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;&gt;(n: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#80-84' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates a new instance of an application requiring a name. The name may be, but doesn't
have to be same as the binary. The name will be displayed to the user when they request to
print version or help and usage information.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">prog</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;My Program&quot;</span>)</pre></div>
</div><h4 id='method.get_name' class="method"><code id='get_name.v'>pub fn <a href='#method.get_name' class='fnname'>get_name</a>(&amp;self) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a class='srclink' href='../src/clap/app/mod.rs.html#87' title='goto source code'>[src]</a></h4><div class='docblock'><p>Get the name of the app</p>
</div><h4 id='method.get_bin_name' class="method"><code id='get_bin_name.v'>pub fn <a href='#method.get_bin_name' class='fnname'>get_bin_name</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;</code><a class='srclink' href='../src/clap/app/mod.rs.html#90' title='goto source code'>[src]</a></h4><div class='docblock'><p>Get the name of the binary</p>
</div><h4 id='method.with_defaults' class="method"><code id='with_defaults.v'>pub fn <a href='#method.with_defaults' class='fnname'>with_defaults</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;&gt;(n: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#107-114' title='goto source code'>[src]</a></h4><div class='stability'><div class='stab deprecated'>Deprecated since 2.14.1: <p>Can never work; use explicit App::author() and App::version() calls instead</p>
</div></div><div class='docblock'><p>Creates a new instance of an application requiring a name, but uses the <a href="./macro.crate_authors!.html"><code>crate_authors!</code></a>
and <a href="./macro.crate_version!.html"><code>crate_version!</code></a> macros to fill in the <a href="./struct.App.html#method.author"><code>App::author</code></a> and <a href="./struct.App.html#method.author"><code>App::version</code></a> fields.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">prog</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">with_defaults</span>(<span class="string">&quot;My Program&quot;</span>)</pre></div>
</div><h4 id='method.author' class="method"><code id='author.v'>pub fn <a href='#method.author' class='fnname'>author</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, author: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#178-181' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets a string of author(s) that will be displayed to the user when they
request the help information with <code>--help</code> or <code>-h</code>.</p>
<p><strong>Pro-tip:</strong> Use <code>clap</code>s convenience macro <a href="./macro.crate_authors!.html"><code>crate_authors!</code></a> to automatically set your
application's author(s) to the same thing as your crate at compile time. See the <a href="https://github.com/clap-rs/clap/tree/master/examples"><code>examples/</code></a>
directory for more information</p>
<p>See the <a href="https://github.com/clap-rs/clap/tree/master/examples"><code>examples/</code></a>
directory for more information</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">author</span>(<span class="string">&quot;Me, me@mymain.com&quot;</span>)</pre></div>
</div><h4 id='method.bin_name' class="method"><code id='bin_name.v'>pub fn <a href='#method.bin_name' class='fnname'>bin_name</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;&gt;(self, name: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#201-204' title='goto source code'>[src]</a></h4><div class='docblock'><p>Overrides the system-determined binary name. This should only be used when absolutely
necessary, such as when the binary name for your application is misleading, or perhaps
<em>not</em> how the user should invoke your program.</p>
<p><strong>Pro-tip:</strong> When building things such as third party <code>cargo</code> subcommands, this setting
<strong>should</strong> be used!</p>
<p><strong>NOTE:</strong> This command <strong>should not</strong> be used for <a href="./struct.SubCommand.html"><code>SubCommand</code></a>s.</p>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;My Program&quot;</span>)
.<span class="ident">bin_name</span>(<span class="string">&quot;my_binary&quot;</span>)</pre></div>
</div><h4 id='method.about' class="method"><code id='about.v'>pub fn <a href='#method.about' class='fnname'>about</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, about: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#224-227' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets a string describing what the program does. This will be displayed when displaying help
information with <code>-h</code>.</p>
<p><strong>NOTE:</strong> If only <code>about</code> is provided, and not <a href="./struct.App.html#method.long_about"><code>App::long_about</code></a> but the user requests
<code>--help</code> clap will still display the contents of <code>about</code> appropriately</p>
<p><strong>NOTE:</strong> Only <a href="../clap/struct.App.html#method.about" title="`App::about`"><code>App::about</code></a> is used in completion script generation in order to be
concise</p>
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">about</span>(<span class="string">&quot;Does really amazing things to great people&quot;</span>)</pre></div>
</div><h4 id='method.long_about' class="method"><code id='long_about.v'>pub fn <a href='#method.long_about' class='fnname'>long_about</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, about: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#250-253' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets a string describing what the program does. This will be displayed when displaying help
information.</p>
<p><strong>NOTE:</strong> If only <code>long_about</code> is provided, and not <a href="./struct.App.html#method.about"><code>App::about</code></a> but the user requests
<code>-h</code> clap will still display the contents of <code>long_about</code> appropriately</p>
<p><strong>NOTE:</strong> Only <a href="./struct.App.html#method.about"><code>App::about</code></a> is used in completion script generation in order to be
concise</p>
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">long_about</span>(
<span class="string">&quot;Does really amazing things to great people. Now let&#39;s talk a little
more in depth about how this subcommand really works. It may take about
a few lines of text, but that&#39;s ok!&quot;</span>)</pre></div>
</div><h4 id='method.name' class="method"><code id='name.v'>pub fn <a href='#method.name' class='fnname'>name</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;&gt;(self, name: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#277-280' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the program's name. This will be displayed when displaying help information.</p>
<p><strong>Pro-top:</strong> This function is particularly useful when configuring a program via
<a href="./struct.App.html#method.from_yaml"><code>App::from_yaml</code></a> in conjunction with the <a href="./macro.crate_name.html"><code>crate_name!</code></a> macro to derive the program's
name from its <code>Cargo.toml</code>.</p>
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="kw">let</span> <span class="ident">yml</span> <span class="op">=</span> <span class="macro">load_yaml</span><span class="macro">!</span>(<span class="string">&quot;app.yml&quot;</span>);
<span class="kw">let</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">from_yaml</span>(<span class="ident">yml</span>)
.<span class="ident">name</span>(<span class="macro">crate_name</span><span class="macro">!</span>());
<span class="comment">// continued logic goes here, such as `app.get_matches()` etc.</span></pre></div>
</div><h4 id='method.after_help' class="method"><code id='after_help.v'>pub fn <a href='#method.after_help' class='fnname'>after_help</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, help: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#294-297' title='goto source code'>[src]</a></h4><div class='docblock'><p>Adds additional help information to be displayed in addition to auto-generated help. This
information is displayed <strong>after</strong> the auto-generated help information. This is often used
to describe how to use the arguments, or caveats to be noted.</p>
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">after_help</span>(<span class="string">&quot;Does really amazing things to great people...but be careful with -R&quot;</span>)</pre></div>
</div><h4 id='method.before_help' class="method"><code id='before_help.v'>pub fn <a href='#method.before_help' class='fnname'>before_help</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, help: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#311-314' title='goto source code'>[src]</a></h4><div class='docblock'><p>Adds additional help information to be displayed in addition to auto-generated help. This
information is displayed <strong>before</strong> the auto-generated help information. This is often used
for header information.</p>
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">before_help</span>(<span class="string">&quot;Some info I&#39;d like to appear before the help info&quot;</span>)</pre></div>
</div><h4 id='method.version' class="method"><code id='version.v'>pub fn <a href='#method.version' class='fnname'>version</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, ver: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#337-340' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets a string of the version number to be displayed when displaying version or help
information with <code>-V</code>.</p>
<p><strong>NOTE:</strong> If only <code>version</code> is provided, and not <a href="./struct.App.html#method.long_version"><code>App::long_version</code></a> but the user
requests <code>--version</code> clap will still display the contents of <code>version</code> appropriately</p>
<p><strong>Pro-tip:</strong> Use <code>clap</code>s convenience macro <a href="./macro.crate_version!.html"><code>crate_version!</code></a> to automatically set your
application's version to the same thing as your crate at compile time. See the <a href="https://github.com/clap-rs/clap/tree/master/examples"><code>examples/</code></a>
directory for more information</p>
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">version</span>(<span class="string">&quot;v0.1.24&quot;</span>)</pre></div>
</div><h4 id='method.long_version' class="method"><code id='long_version.v'>pub fn <a href='#method.long_version' class='fnname'>long_version</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, ver: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#368-371' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets a string of the version number to be displayed when displaying version or help
information with <code>--version</code>.</p>
<p><strong>NOTE:</strong> If only <code>long_version</code> is provided, and not <a href="./struct.App.html#method.version"><code>App::version</code></a> but the user
requests <code>-V</code> clap will still display the contents of <code>long_version</code> appropriately</p>
<p><strong>Pro-tip:</strong> Use <code>clap</code>s convenience macro <a href="./macro.crate_version!.html"><code>crate_version!</code></a> to automatically set your
application's version to the same thing as your crate at compile time. See the <a href="https://github.com/clap-rs/clap/tree/master/examples"><code>examples/</code></a>
directory for more information</p>
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">long_version</span>(
<span class="string">&quot;v0.1.24
commit: abcdef89726d
revision: 123
release: 2
binary: myprog&quot;</span>)</pre></div>
</div><h4 id='method.usage' class="method"><code id='usage.v'>pub fn <a href='#method.usage' class='fnname'>usage</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, usage: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#397-400' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets a custom usage string to override the auto-generated usage string.</p>
<p>This will be displayed to the user when errors are found in argument parsing, or when you
call <a href="./struct.ArgMatches.html#method.usage"><code>ArgMatches::usage</code></a></p>
<p><strong>CAUTION:</strong> Using this setting disables <code>clap</code>s &quot;context-aware&quot; usage strings. After this
setting is set, this will be the only usage string displayed to the user!</p>
<p><strong>NOTE:</strong> You do not need to specify the &quot;USAGE: \n\t&quot; portion, as that will
still be applied by <code>clap</code>, you only need to specify the portion starting
with the binary name.</p>
<p><strong>NOTE:</strong> This will not replace the entire help message, <em>only</em> the portion
showing the usage.</p>
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">usage</span>(<span class="string">&quot;myapp [-clDas] &lt;some_file&gt;&quot;</span>)</pre></div>
</div><h4 id='method.help' class="method"><code id='help.v'>pub fn <a href='#method.help' class='fnname'>help</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, help: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#436-439' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets a custom help message and overrides the auto-generated one. This should only be used
when the auto-generated message does not suffice.</p>
<p>This will be displayed to the user when they use <code>--help</code> or <code>-h</code></p>
<p><strong>NOTE:</strong> This replaces the <strong>entire</strong> help message, so nothing will be auto-generated.</p>
<p><strong>NOTE:</strong> This <strong>only</strong> replaces the help message for the current command, meaning if you
are using subcommands, those help messages will still be auto-generated unless you
specify a <a href="./struct.Arg.html#method.help"><code>Arg::help</code></a> for them as well.</p>
<h1 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myapp&quot;</span>)
.<span class="ident">help</span>(<span class="string">&quot;myapp v1.0\n\
Does awesome things\n\
(C) me@mail.com\n\n\
USAGE: myapp &lt;opts&gt; &lt;command&gt;\n\n\
Options:\n\
-h, --help Display this message\n\
-V, --version Display version info\n\
-s &lt;stuff&gt; Do something with stuff\n\
-v Be verbose\n\n\
Commmands:\n\
help Prints this message\n\
work Do some work&quot;</span>)</pre></div>
</div><h4 id='method.help_short' class="method"><code id='help_short.v'>pub fn <a href='#method.help_short' class='fnname'>help_short</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt; + 'b&gt;(self, s: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#462-465' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the <a href="./struct.Arg.html#method.short"><code>short</code></a> for the auto-generated <code>help</code> argument.</p>
<p>By default <code>clap</code> automatically assigns <code>h</code>, but this can be overridden if you have a
different argument which you'd prefer to use the <code>-h</code> short with. This can be done by
defining your own argument with a lowercase <code>h</code> as the <a href="./struct.Arg.html#method.short"><code>short</code></a>.</p>
<p><code>clap</code> lazily generates these <code>help</code> arguments <strong>after</strong> you've defined any arguments of
your own.</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 <a href="./struct.Arg.html#method.short"><code>short</code></a> version</p>
<h1 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">help_short</span>(<span class="string">&quot;H&quot;</span>) <span class="comment">// Using an uppercase `H` instead of the default lowercase `h`</span></pre></div>
</div><h4 id='method.version_short' class="method"><code id='version_short.v'>pub fn <a href='#method.version_short' class='fnname'>version_short</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, s: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#488-491' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the <a href="./struct.Arg.html#method.short"><code>short</code></a> for the auto-generated <code>version</code> argument.</p>
<p>By default <code>clap</code> automatically assigns <code>V</code>, but this can be overridden if you have a
different argument which you'd prefer to use the <code>-V</code> short with. This can be done by
defining your own argument with an uppercase <code>V</code> as the <a href="./struct.Arg.html#method.short"><code>short</code></a>.</p>
<p><code>clap</code> lazily generates these <code>version</code> arguments <strong>after</strong> you've defined any arguments of
your own.</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-15" class="section-header"><a href="#examples-15">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">version_short</span>(<span class="string">&quot;v&quot;</span>) <span class="comment">// Using a lowercase `v` instead of the default capital `V`</span></pre></div>
</div><h4 id='method.help_message' class="method"><code id='help_message.v'>pub fn <a href='#method.help_message' class='fnname'>help_message</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, s: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#508-511' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the help text for the auto-generated <code>help</code> argument.</p>
<p>By default <code>clap</code> sets this to <code>&quot;Prints help information&quot;</code>, but if you're using a
different convention for your help messages and would prefer a different phrasing you can
override it.</p>
<h1 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">help_message</span>(<span class="string">&quot;Print help information&quot;</span>) <span class="comment">// Perhaps you want imperative help messages</span>
</pre></div>
</div><h4 id='method.version_message' class="method"><code id='version_message.v'>pub fn <a href='#method.version_message' class='fnname'>version_message</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, s: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#526-529' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the help text for the auto-generated <code>version</code> argument.</p>
<p>By default <code>clap</code> sets this to <code>&quot;Prints version information&quot;</code>, but if you're using a
different convention for your help messages and would prefer a different phrasing then you
can change it.</p>
<h1 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">version_message</span>(<span class="string">&quot;Print version information&quot;</span>) <span class="comment">// Perhaps you want imperative help messages</span></pre></div>
</div><h4 id='method.template' class="method"><code id='template.v'>pub fn <a href='#method.template' class='fnname'>template</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, s: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#570-573' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the help template to be used, overriding the default format.</p>
<p>Tags arg given inside curly brackets.</p>
<p>Valid tags are:</p>
<ul>
<li><code>{bin}</code> - Binary name.</li>
<li><code>{version}</code> - Version number.</li>
<li><code>{author}</code> - Author information.</li>
<li><code>{about}</code> - General description (from <a href="./struct.App.html#method.about"><code>App::about</code></a>)</li>
<li><code>{usage}</code> - Automatically generated or given usage string.</li>
<li><code>{all-args}</code> - Help for all arguments (options, flags, positionals arguments,
and subcommands) including titles.</li>
<li><code>{unified}</code> - Unified help for options and flags. Note, you must <em>also</em> set
<a href="./enum.AppSettings.html#variant.UnifiedHelpMessage"><code>AppSettings::UnifiedHelpMessage</code></a> to fully merge both options and
flags, otherwise the ordering is &quot;best effort&quot;</li>
<li><code>{flags}</code> - Help for flags.</li>
<li><code>{options}</code> - Help for options.</li>
<li><code>{positionals}</code> - Help for positionals arguments.</li>
<li><code>{subcommands}</code> - Help for subcommands.</li>
<li><code>{after-help}</code> - Help from <a href="./struct.App.html#method.after_help"><code>App::after_help</code></a></li>
<li><code>{before-help}</code> - Help from <a href="./struct.App.html#method.before_help"><code>App::before_help</code></a></li>
</ul>
<h1 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">version</span>(<span class="string">&quot;1.0&quot;</span>)
.<span class="ident">template</span>(<span class="string">&quot;{bin} ({version}) - {usage}&quot;</span>)</pre></div>
<p><strong>NOTE:</strong> The template system is, on purpose, very simple. Therefore the tags have to be
written in lowercase and without spacing.</p>
</div><h4 id='method.setting' class="method"><code id='setting.v'>pub fn <a href='#method.setting' class='fnname'>setting</a>(self, setting: <a class="enum" href="../clap/enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#590-593' title='goto source code'>[src]</a></h4><div class='docblock'><p>Enables a single command, or <a href="./struct.SubCommand.html"><code>SubCommand</code></a>, level settings.</p>
<p>See <a href="./enum.AppSettings.html"><code>AppSettings</code></a> for a full list of possibilities and examples.</p>
<h1 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">setting</span>(<span class="ident">AppSettings</span>::<span class="ident">SubcommandRequired</span>)
.<span class="ident">setting</span>(<span class="ident">AppSettings</span>::<span class="ident">WaitOnError</span>)</pre></div>
</div><h4 id='method.settings' class="method"><code id='settings.v'>pub fn <a href='#method.settings' class='fnname'>settings</a>(self, settings: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="enum" href="../clap/enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#610-615' title='goto source code'>[src]</a></h4><div class='docblock'><p>Enables multiple command, or <a href="./struct.SubCommand.html"><code>SubCommand</code></a>, level settings</p>
<p>See <a href="./enum.AppSettings.html"><code>AppSettings</code></a> for a full list of possibilities and examples.</p>
<h1 id="examples-20" class="section-header"><a href="#examples-20">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">settings</span>(<span class="kw-2">&amp;</span>[<span class="ident">AppSettings</span>::<span class="ident">SubcommandRequired</span>,
<span class="ident">AppSettings</span>::<span class="ident">WaitOnError</span>])</pre></div>
</div><h4 id='method.global_setting' class="method"><code id='global_setting.v'>pub fn <a href='#method.global_setting' class='fnname'>global_setting</a>(self, setting: <a class="enum" href="../clap/enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#633-637' title='goto source code'>[src]</a></h4><div class='docblock'><p>Enables a single setting that is propagated down through all child <a href="./struct.SubCommand.html"><code>SubCommand</code></a>s.</p>
<p>See <a href="./enum.AppSettings.html"><code>AppSettings</code></a> for a full list of possibilities and examples.</p>
<p><strong>NOTE</strong>: The setting is <em>only</em> propagated <em>down</em> and not up through parent commands.</p>
<h1 id="examples-21" class="section-header"><a href="#examples-21">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">global_setting</span>(<span class="ident">AppSettings</span>::<span class="ident">SubcommandRequired</span>)</pre></div>
</div><h4 id='method.global_settings' class="method"><code id='global_settings.v'>pub fn <a href='#method.global_settings' class='fnname'>global_settings</a>(self, settings: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="enum" href="../clap/enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#656-662' title='goto source code'>[src]</a></h4><div class='docblock'><p>Enables multiple settings which are propagated <em>down</em> through all child <a href="./struct.SubCommand.html"><code>SubCommand</code></a>s.</p>
<p>See <a href="./enum.AppSettings.html"><code>AppSettings</code></a> for a full list of possibilities and examples.</p>
<p><strong>NOTE</strong>: The setting is <em>only</em> propagated <em>down</em> and not up through parent commands.</p>
<h1 id="examples-22" class="section-header"><a href="#examples-22">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">global_settings</span>(<span class="kw-2">&amp;</span>[<span class="ident">AppSettings</span>::<span class="ident">SubcommandRequired</span>,
<span class="ident">AppSettings</span>::<span class="ident">ColoredHelp</span>])</pre></div>
</div><h4 id='method.unset_setting' class="method"><code id='unset_setting.v'>pub fn <a href='#method.unset_setting' class='fnname'>unset_setting</a>(self, setting: <a class="enum" href="../clap/enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#678-681' title='goto source code'>[src]</a></h4><div class='docblock'><p>Disables a single command, or <a href="./struct.SubCommand.html"><code>SubCommand</code></a>, level setting.</p>
<p>See <a href="./enum.AppSettings.html"><code>AppSettings</code></a> for a full list of possibilities and examples.</p>
<h1 id="examples-23" class="section-header"><a href="#examples-23">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">unset_setting</span>(<span class="ident">AppSettings</span>::<span class="ident">ColorAuto</span>)</pre></div>
</div><h4 id='method.unset_settings' class="method"><code id='unset_settings.v'>pub fn <a href='#method.unset_settings' class='fnname'>unset_settings</a>(self, settings: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="enum" href="../clap/enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#698-703' title='goto source code'>[src]</a></h4><div class='docblock'><p>Disables multiple command, or <a href="./struct.SubCommand.html"><code>SubCommand</code></a>, level settings.</p>
<p>See <a href="./enum.AppSettings.html"><code>AppSettings</code></a> for a full list of possibilities and examples.</p>
<h1 id="examples-24" class="section-header"><a href="#examples-24">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">unset_settings</span>(<span class="kw-2">&amp;</span>[<span class="ident">AppSettings</span>::<span class="ident">ColorAuto</span>,
<span class="ident">AppSettings</span>::<span class="ident">AllowInvalidUtf8</span>])</pre></div>
</div><h4 id='method.set_term_width' class="method"><code id='set_term_width.v'>pub fn <a href='#method.set_term_width' class='fnname'>set_term_width</a>(self, width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#730-733' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the terminal width at which to wrap help messages. Defaults to <code>120</code>. Using <code>0</code> will
ignore terminal widths and use source formatting.</p>
<p><code>clap</code> automatically tries to determine the terminal width on Unix, Linux, macOS and Windows
if the <code>wrap_help</code> cargo &quot;feature&quot; has been used while compiling. If the terminal width
cannot be determined, <code>clap</code> defaults to <code>120</code>.</p>
<p><strong>NOTE:</strong> This setting applies globally and <em>not</em> on a per-command basis.</p>
<p><strong>NOTE:</strong> This setting must be set <strong>before</strong> any subcommands are added!</p>
<h1 id="platform-specific" class="section-header"><a href="#platform-specific">Platform Specific</a></h1>
<p>Only Unix, Linux, macOS and Windows support automatic determination of terminal width.
Even on those platforms, this setting is useful if for any reason the terminal width
cannot be determined.</p>
<h1 id="examples-25" class="section-header"><a href="#examples-25">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">set_term_width</span>(<span class="number">80</span>)</pre></div>
</div><h4 id='method.max_term_width' class="method"><code id='max_term_width.v'>pub fn <a href='#method.max_term_width' class='fnname'>max_term_width</a>(self, w: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#758-761' title='goto source code'>[src]</a></h4><div class='docblock'><p>Sets the max terminal width at which to wrap help messages. Using <code>0</code> will ignore terminal
widths and use source formatting.</p>
<p><code>clap</code> automatically tries to determine the terminal width on Unix, Linux, macOS and Windows
if the <code>wrap_help</code> cargo &quot;feature&quot; has been used while compiling, but one might want to
limit the size (e.g. when the terminal is running fullscreen).</p>
<p><strong>NOTE:</strong> This setting applies globally and <em>not</em> on a per-command basis.</p>
<p><strong>NOTE:</strong> This setting must be set <strong>before</strong> any subcommands are added!</p>
<h1 id="platform-specific-1" class="section-header"><a href="#platform-specific-1">Platform Specific</a></h1>
<p>Only Unix, Linux, macOS and Windows support automatic determination of terminal width.</p>
<h1 id="examples-26" class="section-header"><a href="#examples-26">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">max_term_width</span>(<span class="number">100</span>)</pre></div>
</div><h4 id='method.arg' class="method"><code id='arg.v'>pub fn <a href='#method.arg' class='fnname'>arg</a>&lt;A:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../clap/struct.Arg.html" title="struct clap::Arg">Arg</a>&lt;'a, 'b&gt;&gt;&gt;(self, a: A) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#784-787' title='goto source code'>[src]</a></h4><div class='docblock'><p>Adds an <a href="./struct.Arg.html">argument</a> to the list of valid possibilities.</p>
<h1 id="examples-27" class="section-header"><a href="#examples-27">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
<span class="comment">// Adding a single &quot;flag&quot; argument with a short and help text, using Arg::with_name()</span>
.<span class="ident">arg</span>(
<span class="ident">Arg</span>::<span class="ident">with_name</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">short</span>(<span class="string">&quot;d&quot;</span>)
.<span class="ident">help</span>(<span class="string">&quot;turns on debugging mode&quot;</span>)
)
<span class="comment">// Adding a single &quot;option&quot; argument with a short, a long, and help text using the less</span>
<span class="comment">// verbose Arg::from_usage()</span>
.<span class="ident">arg</span>(
<span class="ident">Arg</span>::<span class="ident">from_usage</span>(<span class="string">&quot;-c --config=[CONFIG] &#39;Optionally sets a config file to use&#39;&quot;</span>)
)</pre></div>
</div><h4 id='method.args' class="method"><code id='args.v'>pub fn <a href='#method.args' class='fnname'>args</a>(self, args: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="../clap/struct.Arg.html" title="struct clap::Arg">Arg</a>&lt;'a, 'b&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#803-808' title='goto source code'>[src]</a></h4><div class='docblock'><p>Adds multiple <a href="./struct.Arg.html">arguments</a> to the list of valid possibilities</p>
<h1 id="examples-28" class="section-header"><a href="#examples-28">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">args</span>(
<span class="kw-2">&amp;</span>[<span class="ident">Arg</span>::<span class="ident">from_usage</span>(<span class="string">&quot;[debug] -d &#39;turns on debugging info&#39;&quot;</span>),
<span class="ident">Arg</span>::<span class="ident">with_name</span>(<span class="string">&quot;input&quot;</span>).<span class="ident">index</span>(<span class="number">1</span>).<span class="ident">help</span>(<span class="string">&quot;the input file to use&quot;</span>)]
)</pre></div>
</div><h4 id='method.arg_from_usage' class="method"><code id='arg_from_usage.v'>pub fn <a href='#method.arg_from_usage' class='fnname'>arg_from_usage</a>(self, usage: &amp;'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#827-830' title='goto source code'>[src]</a></h4><div class='docblock'><p>A convenience method for adding a single <a href="./struct.Arg.html">argument</a> from a usage type string. The string
used follows the same rules and syntax as <a href="./struct.Arg.html#method.from_usage"><code>Arg::from_usage</code></a></p>
<p><strong>NOTE:</strong> The downside to using this method is that you can not set any additional
properties of the <a href="./struct.Arg.html"><code>Arg</code></a> other than what <a href="./struct.Arg.html#method.from_usage"><code>Arg::from_usage</code></a> supports.</p>
<h1 id="examples-29" class="section-header"><a href="#examples-29">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">arg_from_usage</span>(<span class="string">&quot;-c --config=&lt;FILE&gt; &#39;Sets a configuration file to use&#39;&quot;</span>)</pre></div>
</div><h4 id='method.args_from_usage' class="method"><code id='args_from_usage.v'>pub fn <a href='#method.args_from_usage' class='fnname'>args_from_usage</a>(self, usage: &amp;'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#854-863' title='goto source code'>[src]</a></h4><div class='docblock'><p>Adds multiple <a href="./struct.Arg.html">arguments</a> at once from a usage string, one per line. See
<a href="./struct.Arg.html#method.from_usage"><code>Arg::from_usage</code></a> for details on the syntax and rules supported.</p>
<p><strong>NOTE:</strong> Like <a href="./struct.App.html#method.arg_from_usage"><code>App::arg_from_usage</code></a> the downside is you only set properties for the
<a href="./struct.Arg.html"><code>Arg</code></a>s which <a href="./struct.Arg.html#method.from_usage"><code>Arg::from_usage</code></a> supports.</p>
<h1 id="examples-30" class="section-header"><a href="#examples-30">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">args_from_usage</span>(
<span class="string">&quot;-c --config=[FILE] &#39;Sets a configuration file to use&#39;
[debug]... -d &#39;Sets the debugging level&#39;
&lt;FILE&gt; &#39;The input file to use&#39;&quot;</span>
)</pre></div>
</div><h4 id='method.alias' class="method"><code id='alias.v'>pub fn <a href='#method.alias' class='fnname'>alias</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, name: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#881-888' title='goto source code'>[src]</a></h4><div class='docblock'><p>Allows adding a <a href="./struct.SubCommand.html"><code>SubCommand</code></a> alias, which function as &quot;hidden&quot; subcommands that
automatically dispatch as if this subcommand was used. This is more efficient, and easier
than creating multiple hidden subcommands as one only needs to check for the existence of
this command, and not all variants.</p>
<h1 id="examples-31" class="section-header"><a href="#examples-31">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">subcommand</span>(<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">alias</span>(<span class="string">&quot;do-stuff&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;do-stuff&quot;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">m</span>.<span class="ident">subcommand_name</span>(), <span class="prelude-val">Some</span>(<span class="string">&quot;test&quot;</span>));</pre></div>
</div><h4 id='method.aliases' class="method"><code id='aliases.v'>pub fn <a href='#method.aliases' class='fnname'>aliases</a>(self, names: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a>&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#910-919' title='goto source code'>[src]</a></h4><div class='docblock'><p>Allows adding <a href="./struct.SubCommand.html"><code>SubCommand</code></a> aliases, which function as &quot;hidden&quot; subcommands that
automatically dispatch as if this subcommand was used. This is more efficient, and easier
than creating multiple hidden subcommands as one only needs to check for the existence of
this command, and not all variants.</p>
<h1 id="examples-32" class="section-header"><a href="#examples-32">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">subcommand</span>(<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">aliases</span>(<span class="kw-2">&amp;</span>[<span class="string">&quot;do-stuff&quot;</span>, <span class="string">&quot;do-tests&quot;</span>, <span class="string">&quot;tests&quot;</span>]))
.<span class="ident">arg</span>(<span class="ident">Arg</span>::<span class="ident">with_name</span>(<span class="string">&quot;input&quot;</span>)
.<span class="ident">help</span>(<span class="string">&quot;the file to add&quot;</span>)
.<span class="ident">index</span>(<span class="number">1</span>)
.<span class="ident">required</span>(<span class="bool-val">false</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;do-tests&quot;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">m</span>.<span class="ident">subcommand_name</span>(), <span class="prelude-val">Some</span>(<span class="string">&quot;test&quot;</span>));</pre></div>
</div><h4 id='method.visible_alias' class="method"><code id='visible_alias.v'>pub fn <a href='#method.visible_alias' class='fnname'>visible_alias</a>&lt;S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;(self, name: S) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#936-943' title='goto source code'>[src]</a></h4><div class='docblock'><p>Allows adding a <a href="./struct.SubCommand.html"><code>SubCommand</code></a> alias that functions exactly like those defined with
<a href="./struct.App.html#method.alias"><code>App::alias</code></a>, except that they are visible inside the help message.</p>
<h1 id="examples-33" class="section-header"><a href="#examples-33">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">subcommand</span>(<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">visible_alias</span>(<span class="string">&quot;do-stuff&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;do-stuff&quot;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">m</span>.<span class="ident">subcommand_name</span>(), <span class="prelude-val">Some</span>(<span class="string">&quot;test&quot;</span>));</pre></div>
</div><h4 id='method.visible_aliases' class="method"><code id='visible_aliases.v'>pub fn <a href='#method.visible_aliases' class='fnname'>visible_aliases</a>(self, names: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a>&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#960-969' title='goto source code'>[src]</a></h4><div class='docblock'><p>Allows adding multiple <a href="./struct.SubCommand.html"><code>SubCommand</code></a> aliases that functions exactly like those defined
with <a href="./struct.App.html#method.aliases"><code>App::aliases</code></a>, except that they are visible inside the help message.</p>
<h1 id="examples-34" class="section-header"><a href="#examples-34">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">subcommand</span>(<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">visible_aliases</span>(<span class="kw-2">&amp;</span>[<span class="string">&quot;do-stuff&quot;</span>, <span class="string">&quot;tests&quot;</span>]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;do-stuff&quot;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">m</span>.<span class="ident">subcommand_name</span>(), <span class="prelude-val">Some</span>(<span class="string">&quot;test&quot;</span>));</pre></div>
</div><h4 id='method.group' class="method"><code id='group.v'>pub fn <a href='#method.group' class='fnname'>group</a>(self, group: <a class="struct" href="../clap/struct.ArgGroup.html" title="struct clap::ArgGroup">ArgGroup</a>&lt;'a&gt;) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#1005-1008' title='goto source code'>[src]</a></h4><div class='docblock'><p>Adds an <a href="./struct.ArgGroup.html"><code>ArgGroup</code></a> to the application. <a href="./struct.ArgGroup.html"><code>ArgGroup</code></a>s are a family of related arguments.
By placing them in a logical group, you can build easier requirement and exclusion rules.
For instance, you can make an entire <a href="./struct.ArgGroup.html"><code>ArgGroup</code></a> required, meaning that one (and <em>only</em>
one) argument from that group must be present at runtime.</p>
<p>You can also do things such as name an <a href="./struct.ArgGroup.html"><code>ArgGroup</code></a> as a conflict to another argument.
Meaning any of the arguments that belong to that group will cause a failure if present with
the conflicting argument.</p>
<p>Another added benefit of <a href="./struct.ArgGroup.html"><code>ArgGroup</code></a>s is that you can extract a value from a group instead
of determining exactly which argument was used.</p>
<p>Finally, using <a href="./struct.ArgGroup.html"><code>ArgGroup</code></a>s to ensure exclusion between arguments is another very common
use</p>
<h1 id="examples-35" class="section-header"><a href="#examples-35">Examples</a></h1>
<p>The following example demonstrates using an <a href="./struct.ArgGroup.html"><code>ArgGroup</code></a> to ensure that one, and only one,
of the arguments from the specified group is present at runtime.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;app&quot;</span>)
.<span class="ident">args_from_usage</span>(
<span class="string">&quot;--set-ver [ver] &#39;set the version manually&#39;
--major &#39;auto increase major&#39;
--minor &#39;auto increase minor&#39;
--patch &#39;auto increase patch&#39;&quot;</span>)
.<span class="ident">group</span>(<span class="ident">ArgGroup</span>::<span class="ident">with_name</span>(<span class="string">&quot;vers&quot;</span>)
.<span class="ident">args</span>(<span class="kw-2">&amp;</span>[<span class="string">&quot;set-ver&quot;</span>, <span class="string">&quot;major&quot;</span>, <span class="string">&quot;minor&quot;</span>,<span class="string">&quot;patch&quot;</span>])
.<span class="ident">required</span>(<span class="bool-val">true</span>))</pre></div>
</div><h4 id='method.groups' class="method"><code id='groups.v'>pub fn <a href='#method.groups' class='fnname'>groups</a>(self, groups: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="../clap/struct.ArgGroup.html" title="struct clap::ArgGroup">ArgGroup</a>&lt;'a&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#1035-1040' title='goto source code'>[src]</a></h4><div class='docblock'><p>Adds multiple <a href="./struct.ArgGroup.html"><code>ArgGroup</code></a>s to the <a href="./struct.App.html"><code>App</code></a> at once.</p>
<h1 id="examples-36" class="section-header"><a href="#examples-36">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;app&quot;</span>)
.<span class="ident">args_from_usage</span>(
<span class="string">&quot;--set-ver [ver] &#39;set the version manually&#39;
--major &#39;auto increase major&#39;
--minor &#39;auto increase minor&#39;
--patch &#39;auto increase patch&#39;
-c [FILE] &#39;a config file&#39;
-i [IFACE] &#39;an interface&#39;&quot;</span>)
.<span class="ident">groups</span>(<span class="kw-2">&amp;</span>[
<span class="ident">ArgGroup</span>::<span class="ident">with_name</span>(<span class="string">&quot;vers&quot;</span>)
.<span class="ident">args</span>(<span class="kw-2">&amp;</span>[<span class="string">&quot;set-ver&quot;</span>, <span class="string">&quot;major&quot;</span>, <span class="string">&quot;minor&quot;</span>,<span class="string">&quot;patch&quot;</span>])
.<span class="ident">required</span>(<span class="bool-val">true</span>),
<span class="ident">ArgGroup</span>::<span class="ident">with_name</span>(<span class="string">&quot;input&quot;</span>)
.<span class="ident">args</span>(<span class="kw-2">&amp;</span>[<span class="string">&quot;c&quot;</span>, <span class="string">&quot;i&quot;</span>])
])</pre></div>
</div><h4 id='method.subcommand' class="method"><code id='subcommand.v'>pub fn <a href='#method.subcommand' class='fnname'>subcommand</a>(self, subcmd: <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#1059-1062' title='goto source code'>[src]</a></h4><div class='docblock'><p>Adds a <a href="./struct.SubCommand.html"><code>SubCommand</code></a> to the list of valid possibilities. Subcommands are effectively
sub-<a href="./struct.App.html"><code>App</code></a>s, because they can contain their own arguments, subcommands, version, usage,
etc. They also function just like <a href="./struct.App.html"><code>App</code></a>s, in that they get their own auto generated help,
version, and usage.</p>
<h1 id="examples-37" class="section-header"><a href="#examples-37">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">subcommand</span>(<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">about</span>(<span class="string">&quot;Controls configuration features&quot;</span>)
.<span class="ident">arg_from_usage</span>(<span class="string">&quot;&lt;config&gt; &#39;Required configuration file to use&#39;&quot;</span>))</pre></div>
</div><h4 id='method.subcommands' class="method"><code id='subcommands.v'>pub fn <a href='#method.subcommands' class='fnname'>subcommands</a>&lt;I&gt;(self, subcmds: I) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;&gt;,&nbsp;</span></code><a class='srclink' href='../src/clap/app/mod.rs.html#1080-1088' title='goto source code'>[src]</a></h4><div class='docblock'><p>Adds multiple subcommands to the list of valid possibilities by iterating over an
<a href="https://doc.rust-lang.org/std/iter/trait.IntoIterator.html"><code>IntoIterator</code></a> of <a href="./struct.SubCommand.html"><code>SubCommand</code></a>s</p>
<h1 id="examples-38" class="section-header"><a href="#examples-38">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
.<span class="ident">subcommands</span>( <span class="macro">vec</span><span class="macro">!</span>[
<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;config&quot;</span>).<span class="ident">about</span>(<span class="string">&quot;Controls configuration functionality&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg</span>::<span class="ident">with_name</span>(<span class="string">&quot;config_file&quot;</span>).<span class="ident">index</span>(<span class="number">1</span>)),
<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;debug&quot;</span>).<span class="ident">about</span>(<span class="string">&quot;Controls debug functionality&quot;</span>)])</pre></div>
</div><h4 id='method.display_order' class="method"><code id='display_order.v'>pub fn <a href='#method.display_order' class='fnname'>display_order</a>(self, ord: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#1137-1140' title='goto source code'>[src]</a></h4><div class='docblock'><p>Allows custom ordering of <a href="./struct.SubCommand.html"><code>SubCommand</code></a>s within the help message. Subcommands with a lower
value will be displayed first in the help message. This is helpful when one would like to
emphasise frequently used subcommands, or prioritize those towards the top of the list.
Duplicate values <strong>are</strong> allowed. Subcommands with duplicate display orders will be
displayed in alphabetical order.</p>
<p><strong>NOTE:</strong> The default is 999 for all subcommands.</p>
<h1 id="examples-39" class="section-header"><a href="#examples-39">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;cust-ord&quot;</span>)
.<span class="ident">subcommand</span>(<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;alpha&quot;</span>) <span class="comment">// typically subcommands are grouped</span>
<span class="comment">// alphabetically by name. Subcommands</span>
<span class="comment">// without a display_order have a value of</span>
<span class="comment">// 999 and are displayed alphabetically with</span>
<span class="comment">// all other 999 subcommands</span>
.<span class="ident">about</span>(<span class="string">&quot;Some help and text&quot;</span>))
.<span class="ident">subcommand</span>(<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;beta&quot;</span>)
.<span class="ident">display_order</span>(<span class="number">1</span>) <span class="comment">// In order to force this subcommand to appear *first*</span>
<span class="comment">// all we have to do is give it a value lower than 999.</span>
<span class="comment">// Any other subcommands with a value of 1 will be displayed</span>
<span class="comment">// alphabetically with this one...then 2 values, then 3, etc.</span>
.<span class="ident">about</span>(<span class="string">&quot;I should be first!&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec</span><span class="macro">!</span>[
<span class="string">&quot;cust-ord&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</pre></div>
<p>The above example displays the following help message</p>
<pre><code class="language-text">cust-ord
USAGE:
cust-ord [FLAGS] [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
beta I should be first!
alpha Some help and text
</code></pre>
</div><h4 id='method.print_help' class="method"><code id='print_help.v'>pub fn <a href='#method.print_help' class='fnname'>print_help</a>(&amp;mut self) -&gt; <a class="type" href="../clap/type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/clap/app/mod.rs.html#1159-1170' title='goto source code'>[src]</a></h4><div class='docblock'><p>Prints the full help message to <a href="https://doc.rust-lang.org/std/io/fn.stdout.html"><code>io::stdout()</code></a> using a <a href="https://doc.rust-lang.org/std/io/struct.BufWriter.html"><code>BufWriter</code></a> using the same
method as if someone ran <code>-h</code> to request the help message</p>
<p><strong>NOTE:</strong> clap has the ability to distinguish between &quot;short&quot; and &quot;long&quot; help messages
depending on if the user ran <a href="./struct.Arg.html#method.help"><code>-h</code> (short)</a> or <a href="./struct.Arg.html#method.long_help"><code>--help</code> (long)</a></p>
<h1 id="examples-40" class="section-header"><a href="#examples-40">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>);
<span class="ident">app</span>.<span class="ident">print_help</span>();</pre></div>
</div><h4 id='method.print_long_help' class="method"><code id='print_long_help.v'>pub fn <a href='#method.print_long_help' class='fnname'>print_long_help</a>(&amp;mut self) -&gt; <a class="type" href="../clap/type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/clap/app/mod.rs.html#1189-1193' title='goto source code'>[src]</a></h4><div class='docblock'><p>Prints the full help message to <a href="https://doc.rust-lang.org/std/io/fn.stdout.html"><code>io::stdout()</code></a> using a <a href="https://doc.rust-lang.org/std/io/struct.BufWriter.html"><code>BufWriter</code></a> using the same
method as if someone ran <code>--help</code> to request the help message</p>
<p><strong>NOTE:</strong> clap has the ability to distinguish between &quot;short&quot; and &quot;long&quot; help messages
depending on if the user ran <a href="./struct.Arg.html#method.help"><code>-h</code> (short)</a> or <a href="./struct.Arg.html#method.long_help"><code>--help</code> (long)</a></p>
<h1 id="examples-41" class="section-header"><a href="#examples-41">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>);
<span class="ident">app</span>.<span class="ident">print_long_help</span>();</pre></div>
</div><h4 id='method.write_help' class="method"><code id='write_help.v'>pub fn <a href='#method.write_help' class='fnname'>write_help</a>&lt;W:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a>&gt;(&amp;self, w: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>W) -&gt; <a class="type" href="../clap/type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/clap/app/mod.rs.html#1217-1228' title='goto source code'>[src]</a></h4><div class='docblock'><p>Writes the full help message to the user to a <a href="https://doc.rust-lang.org/std/io/trait.Write.html"><code>io::Write</code></a> object in the same method as if
the user ran <code>-h</code></p>
<p><strong>NOTE:</strong> clap has the ability to distinguish between &quot;short&quot; and &quot;long&quot; help messages
depending on if the user ran <a href="./struct.Arg.html#method.help"><code>-h</code> (short)</a> or <a href="./struct.Arg.html#method.long_help"><code>--help</code> (long)</a></p>
<p><strong>NOTE:</strong> There is a known bug where this method does not write propagated global arguments
or autogenerated arguments (i.e. the default help/version args). Prefer
<a href="../clap/struct.App.html#method.write_long_help" title="`App::write_long_help`"><code>App::write_long_help</code></a> instead if possible!</p>
<h1 id="examples-42" class="section-header"><a href="#examples-42">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">out</span> <span class="op">=</span> <span class="ident">io</span>::<span class="ident">stdout</span>();
<span class="ident">app</span>.<span class="ident">write_help</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">out</span>).<span class="ident">expect</span>(<span class="string">&quot;failed to write to stdout&quot;</span>);</pre></div>
</div><h4 id='method.write_long_help' class="method"><code id='write_long_help.v'>pub fn <a href='#method.write_long_help' class='fnname'>write_long_help</a>&lt;W:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a>&gt;(&amp;mut self, w: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>W) -&gt; <a class="type" href="../clap/type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/clap/app/mod.rs.html#1248-1257' title='goto source code'>[src]</a></h4><div class='docblock'><p>Writes the full help message to the user to a <a href="https://doc.rust-lang.org/std/io/trait.Write.html"><code>io::Write</code></a> object in the same method as if
the user ran <code>--help</code></p>
<p><strong>NOTE:</strong> clap has the ability to distinguish between &quot;short&quot; and &quot;long&quot; help messages
depending on if the user ran <a href="./struct.Arg.html#method.help"><code>-h</code> (short)</a> or <a href="./struct.Arg.html#method.long_help"><code>--help</code> (long)</a></p>
<h1 id="examples-43" class="section-header"><a href="#examples-43">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">out</span> <span class="op">=</span> <span class="ident">io</span>::<span class="ident">stdout</span>();
<span class="ident">app</span>.<span class="ident">write_long_help</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">out</span>).<span class="ident">expect</span>(<span class="string">&quot;failed to write to stdout&quot;</span>);</pre></div>
</div><h4 id='method.write_version' class="method"><code id='write_version.v'>pub fn <a href='#method.write_version' class='fnname'>write_version</a>&lt;W:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a>&gt;(&amp;self, w: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>W) -&gt; <a class="type" href="../clap/type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/clap/app/mod.rs.html#1276-1278' title='goto source code'>[src]</a></h4><div class='docblock'><p>Writes the version message to the user to a <a href="https://doc.rust-lang.org/std/io/trait.Write.html"><code>io::Write</code></a> object as if the user ran <code>-V</code>.</p>
<p><strong>NOTE:</strong> clap has the ability to distinguish between &quot;short&quot; and &quot;long&quot; version messages
depending on if the user ran <a href="./struct.App.html#method.version"><code>-V</code> (short)</a> or <a href="./struct.App.html#method.long_version"><code>--version</code> (long)</a></p>
<h1 id="examples-44" class="section-header"><a href="#examples-44">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">out</span> <span class="op">=</span> <span class="ident">io</span>::<span class="ident">stdout</span>();
<span class="ident">app</span>.<span class="ident">write_version</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">out</span>).<span class="ident">expect</span>(<span class="string">&quot;failed to write to stdout&quot;</span>);</pre></div>
</div><h4 id='method.write_long_version' class="method"><code id='write_long_version.v'>pub fn <a href='#method.write_long_version' class='fnname'>write_long_version</a>&lt;W:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a>&gt;(&amp;self, w: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>W) -&gt; <a class="type" href="../clap/type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class='srclink' href='../src/clap/app/mod.rs.html#1297-1299' title='goto source code'>[src]</a></h4><div class='docblock'><p>Writes the version message to the user to a <a href="https://doc.rust-lang.org/std/io/trait.Write.html"><code>io::Write</code></a> object</p>
<p><strong>NOTE:</strong> clap has the ability to distinguish between &quot;short&quot; and &quot;long&quot; version messages
depending on if the user ran <a href="./struct.App.html#method.version"><code>-V</code> (short)</a> or <a href="./struct.App.html#method.long_version"><code>--version</code> (long)</a></p>
<h1 id="examples-45" class="section-header"><a href="#examples-45">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>;
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">out</span> <span class="op">=</span> <span class="ident">io</span>::<span class="ident">stdout</span>();
<span class="ident">app</span>.<span class="ident">write_long_version</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">out</span>).<span class="ident">expect</span>(<span class="string">&quot;failed to write to stdout&quot;</span>);</pre></div>
</div><h4 id='method.gen_completions' class="method"><code id='gen_completions.v'>pub fn <a href='#method.gen_completions' class='fnname'>gen_completions</a>&lt;T:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsString.html" title="struct std::ffi::os_str::OsString">OsString</a>&gt;, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bin_name: S, <br>&nbsp;&nbsp;&nbsp;&nbsp;for_shell: <a class="enum" href="../clap/enum.Shell.html" title="enum clap::Shell">Shell</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;out_dir: T<br>)</code><a class='srclink' href='../src/clap/app/mod.rs.html#1384-1392' title='goto source code'>[src]</a></h4><div class='docblock'><p>Generate a completions file for a specified shell at compile time.</p>
<p><strong>NOTE:</strong> to generate the file at compile time you must use a <code>build.rs</code> &quot;Build Script&quot;</p>
<h1 id="examples-46" class="section-header"><a href="#examples-46">Examples</a></h1>
<p>The following example generates a bash completion script via a <code>build.rs</code> script. In this
simple example, we'll demo a very small application with only a single subcommand and two
args. Real applications could be many multiple levels deep in subcommands, and have tens or
potentially hundreds of arguments.</p>
<p>First, it helps if we separate out our <code>App</code> definition into a separate file. Whether you
do this as a function, or bare App definition is a matter of personal preference.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="comment">// src/cli.rs</span>
<span class="kw">use</span> <span class="ident">clap</span>::{<span class="ident">App</span>, <span class="ident">Arg</span>, <span class="ident">SubCommand</span>};
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">build_cli</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="ident">App</span><span class="op">&lt;</span><span class="lifetime">&#39;static</span>, <span class="lifetime">&#39;static</span><span class="op">&gt;</span> {
<span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;compl&quot;</span>)
.<span class="ident">about</span>(<span class="string">&quot;Tests completions&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg</span>::<span class="ident">with_name</span>(<span class="string">&quot;file&quot;</span>)
.<span class="ident">help</span>(<span class="string">&quot;some input file&quot;</span>))
.<span class="ident">subcommand</span>(<span class="ident">SubCommand</span>::<span class="ident">with_name</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">about</span>(<span class="string">&quot;tests things&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg</span>::<span class="ident">with_name</span>(<span class="string">&quot;case&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;case&quot;</span>)
.<span class="ident">takes_value</span>(<span class="bool-val">true</span>)
.<span class="ident">help</span>(<span class="string">&quot;the case to test&quot;</span>)))
}</pre></div>
<p>In our regular code, we can simply call this <code>build_cli()</code> function, then call
<code>get_matches()</code>, or any of the other normal methods directly after. For example:</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="comment">// src/main.rs</span>
<span class="kw">mod</span> <span class="ident">cli</span>;
<span class="kw">fn</span> <span class="ident">main</span>() {
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cli</span>::<span class="ident">build_cli</span>().<span class="ident">get_matches</span>();
<span class="comment">// normal logic continues...</span>
}</pre></div>
<p>Next, we set up our <code>Cargo.toml</code> to use a <code>build.rs</code> build script.</p>
<pre><code class="language-toml"># Cargo.toml
build = &quot;build.rs&quot;
[build-dependencies]
clap = &quot;2.23&quot;
</code></pre>
<p>Next, we place a <code>build.rs</code> in our project root.</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">clap</span>;
<span class="kw">use</span> <span class="ident">clap</span>::<span class="ident">Shell</span>;
<span class="macro">include</span><span class="macro">!</span>(<span class="string">&quot;src/cli.rs&quot;</span>);
<span class="kw">fn</span> <span class="ident">main</span>() {
<span class="kw">let</span> <span class="ident">outdir</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">env</span>::<span class="ident">var_os</span>(<span class="string">&quot;OUT_DIR&quot;</span>) {
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> <span class="kw">return</span>,
<span class="prelude-val">Some</span>(<span class="ident">outdir</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">outdir</span>,
};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">build_cli</span>();
<span class="ident">app</span>.<span class="ident">gen_completions</span>(<span class="string">&quot;myapp&quot;</span>, <span class="comment">// We need to specify the bin name manually</span>
<span class="ident">Shell</span>::<span class="ident">Bash</span>, <span class="comment">// Then say which shell to build completions for</span>
<span class="ident">outdir</span>); <span class="comment">// Then say where write the completions to</span>
}</pre></div>
<p>Now, once we compile there will be a <code>{bin_name}.bash</code> file in the directory.
Assuming we compiled with debug mode, it would be somewhere similar to
<code>&lt;project&gt;/target/debug/build/myapp-&lt;hash&gt;/out/myapp.bash</code>.</p>
<p>Fish shell completions will use the file format <code>{bin_name}.fish</code></p>
</div><h4 id='method.gen_completions_to' class="method"><code id='gen_completions_to.v'>pub fn <a href='#method.gen_completions_to' class='fnname'>gen_completions_to</a>&lt;W:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a>, S:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bin_name: S, <br>&nbsp;&nbsp;&nbsp;&nbsp;for_shell: <a class="enum" href="../clap/enum.Shell.html" title="enum clap::Shell">Shell</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>W<br>)</code><a class='srclink' href='../src/clap/app/mod.rs.html#1427-1435' title='goto source code'>[src]</a></h4><div class='docblock'><p>Generate a completions file for a specified shell at runtime. Until <code>cargo install</code> can
install extra files like a completion script, this may be used e.g. in a command that
outputs the contents of the completion script, to be redirected into a file by the user.</p>
<h1 id="examples-47" class="section-header"><a href="#examples-47">Examples</a></h1>
<p>Assuming a separate <code>cli.rs</code> like the <a href="./struct.App.html#method.gen_completions">example above</a>,
we can let users generate a completion script using a command:</p>
<div class='information'><div class='tooltip ignore'><span class='tooltiptext'>This example is not tested</span></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
<span class="comment">// src/main.rs</span>
<span class="kw">mod</span> <span class="ident">cli</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>;
<span class="kw">fn</span> <span class="ident">main</span>() {
<span class="kw">let</span> <span class="ident">matches</span> <span class="op">=</span> <span class="ident">cli</span>::<span class="ident">build_cli</span>().<span class="ident">get_matches</span>();
<span class="kw">if</span> <span class="ident">matches</span>.<span class="ident">is_present</span>(<span class="string">&quot;generate-bash-completions&quot;</span>) {
<span class="ident">cli</span>::<span class="ident">build_cli</span>().<span class="ident">gen_completions_to</span>(<span class="string">&quot;myapp&quot;</span>, <span class="ident">Shell</span>::<span class="ident">Bash</span>, <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">io</span>::<span class="ident">stdout</span>());
}
<span class="comment">// normal logic continues...</span>
}
</pre></div>
<p>Usage:</p>
<pre><code class="language-shell">$ myapp generate-bash-completions &gt; /usr/share/bash-completion/completions/myapp.bash
</code></pre>
</div><h4 id='method.get_matches' class="method"><code id='get_matches.v'>pub fn <a href='#method.get_matches' class='fnname'>get_matches</a>(self) -&gt; <a class="struct" href="../clap/struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>&lt;'a&gt;</code><a class='srclink' href='../src/clap/app/mod.rs.html#1451' title='goto source code'>[src]</a></h4><div class='docblock'><p>Starts the parsing process, upon a failed parse an error will be displayed to the user and
the process will exit with the appropriate error code. By default this method gets all user
provided arguments from <a href="https://doc.rust-lang.org/std/env/fn.args_os.html"><code>env::args_os</code></a> in order to allow for invalid UTF-8 code points,
which are legal on many platforms.</p>
<h1 id="examples-48" class="section-header"><a href="#examples-48">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">matches</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
<span class="comment">// Args and options go here...</span>
.<span class="ident">get_matches</span>();</pre></div>
</div><h4 id='method.get_matches_safe' class="method"><code id='get_matches_safe.v'>pub fn <a href='#method.get_matches_safe' class='fnname'>get_matches_safe</a>(self) -&gt; <a class="type" href="../clap/type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="struct" href="../clap/struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>&lt;'a&gt;&gt;</code><a class='srclink' href='../src/clap/app/mod.rs.html#1478-1481' title='goto source code'>[src]</a></h4><div class='docblock'><p>Starts the parsing process. This method will return a <a href="./type.Result.html"><code>clap::Result</code></a> type instead of exiting
the process on failed parse. By default this method gets matches from <a href="https://doc.rust-lang.org/std/env/fn.args_os.html"><code>env::args_os</code></a></p>
<p><strong>NOTE:</strong> This method WILL NOT exit when <code>--help</code> or <code>--version</code> (or short versions) are
used. It will return a <a href="./struct.Error.html"><code>clap::Error</code></a>, where the <a href="./struct.Error.html"><code>kind</code></a> is a
<a href="./enum.ErrorKind.html#variant.HelpDisplayed"><code>ErrorKind::HelpDisplayed</code></a> or <a href="./enum.ErrorKind.html#variant.VersionDisplayed"><code>ErrorKind::VersionDisplayed</code></a> respectively. You must call
<a href="./struct.Error.html#method.exit"><code>Error::exit</code></a> or perform a <a href="https://doc.rust-lang.org/std/process/fn.exit.html"><code>std::process::exit</code></a>.</p>
<h1 id="examples-49" class="section-header"><a href="#examples-49">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">matches</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
<span class="comment">// Args and options go here...</span>
.<span class="ident">get_matches_safe</span>()
.<span class="ident">unwrap_or_else</span>( <span class="op">|</span><span class="ident">e</span><span class="op">|</span> <span class="ident">e</span>.<span class="ident">exit</span>() );</pre></div>
</div><h4 id='method.get_matches_from' class="method"><code id='get_matches_from.v'>pub fn <a href='#method.get_matches_from' class='fnname'>get_matches_from</a>&lt;I, T&gt;(self, itr: I) -&gt; <a class="struct" href="../clap/struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>&lt;'a&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsString.html" title="struct std::ffi::os_str::OsString">OsString</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a class='srclink' href='../src/clap/app/mod.rs.html#1504-1527' title='goto source code'>[src]</a></h4><div class='docblock'><p>Starts the parsing process. Like <a href="./struct.App.html#method.get_matches"><code>App::get_matches</code></a> this method does not return a <a href="./type.Result.html"><code>clap::Result</code></a>
and will automatically exit with an error message. This method, however, lets you specify
what iterator to use when performing matches, such as a <a href="https://doc.rust-lang.org/std/vec/struct.Vec.html"><code>Vec</code></a> of your making.</p>
<p><strong>NOTE:</strong> The first argument will be parsed as the binary name unless
<a href="./enum.AppSettings.html#variant.NoBinaryName"><code>AppSettings::NoBinaryName</code></a> is used</p>
<h1 id="examples-50" class="section-header"><a href="#examples-50">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">arg_vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;my_prog&quot;</span>, <span class="string">&quot;some&quot;</span>, <span class="string">&quot;args&quot;</span>, <span class="string">&quot;to&quot;</span>, <span class="string">&quot;parse&quot;</span>];
<span class="kw">let</span> <span class="ident">matches</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
<span class="comment">// Args and options go here...</span>
.<span class="ident">get_matches_from</span>(<span class="ident">arg_vec</span>);</pre></div>
</div><h4 id='method.get_matches_from_safe' class="method"><code id='get_matches_from_safe.v'>pub fn <a href='#method.get_matches_from_safe' class='fnname'>get_matches_from_safe</a>&lt;I, T&gt;(self, itr: I) -&gt; <a class="type" href="../clap/type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="struct" href="../clap/struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>&lt;'a&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsString.html" title="struct std::ffi::os_str::OsString">OsString</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a class='srclink' href='../src/clap/app/mod.rs.html#1561-1567' title='goto source code'>[src]</a></h4><div class='docblock'><p>Starts the parsing process. A combination of <a href="./struct.App.html#method.get_matches_from"><code>App::get_matches_from</code></a>, and
<a href="./struct.App.html#method.get_matches_safe"><code>App::get_matches_safe</code></a></p>
<p><strong>NOTE:</strong> This method WILL NOT exit when <code>--help</code> or <code>--version</code> (or short versions) are
used. It will return a <a href="./struct.Error.html"><code>clap::Error</code></a>, where the <a href="./struct.Error.html"><code>kind</code></a> is a <a href="./enum.ErrorKind.html#variant.HelpDisplayed"><code>ErrorKind::HelpDisplayed</code></a>
or <a href="./enum.ErrorKind.html#variant.VersionDisplayed"><code>ErrorKind::VersionDisplayed</code></a> respectively. You must call <a href="./struct.Error.html#method.exit"><code>Error::exit</code></a> or
perform a <a href="https://doc.rust-lang.org/std/process/fn.exit.html"><code>std::process::exit</code></a> yourself.</p>
<p><strong>NOTE:</strong> The first argument will be parsed as the binary name unless
<a href="./enum.AppSettings.html#variant.NoBinaryName"><code>AppSettings::NoBinaryName</code></a> is used</p>
<h1 id="examples-51" class="section-header"><a href="#examples-51">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">arg_vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;my_prog&quot;</span>, <span class="string">&quot;some&quot;</span>, <span class="string">&quot;args&quot;</span>, <span class="string">&quot;to&quot;</span>, <span class="string">&quot;parse&quot;</span>];
<span class="kw">let</span> <span class="ident">matches</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>)
<span class="comment">// Args and options go here...</span>
.<span class="ident">get_matches_from_safe</span>(<span class="ident">arg_vec</span>)
.<span class="ident">unwrap_or_else</span>( <span class="op">|</span><span class="ident">e</span><span class="op">|</span> { <span class="macro">panic</span><span class="macro">!</span>(<span class="string">&quot;An error occurs: {}&quot;</span>, <span class="ident">e</span>) });</pre></div>
</div><h4 id='method.get_matches_from_safe_borrow' class="method"><code id='get_matches_from_safe_borrow.v'>pub fn <a href='#method.get_matches_from_safe_borrow' class='fnname'>get_matches_from_safe_borrow</a>&lt;I, T&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;itr: I<br>) -&gt; <a class="type" href="../clap/type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="struct" href="../clap/struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>&lt;'a&gt;&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/ffi/os_str/struct.OsString.html" title="struct std::ffi::os_str::OsString">OsString</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a class='srclink' href='../src/clap/app/mod.rs.html#1590-1637' title='goto source code'>[src]</a></h4><div class='docblock'><p>Starts the parsing process without consuming the <a href="./struct.App.html"><code>App</code></a> struct <code>self</code>. This is normally not
the desired functionality, instead prefer <a href="./struct.App.html#method.get_matches_from_safe"><code>App::get_matches_from_safe</code></a> which <em>does</em>
consume <code>self</code>.</p>
<p><strong>NOTE:</strong> The first argument will be parsed as the binary name unless
<a href="./enum.AppSettings.html#variant.NoBinaryName"><code>AppSettings::NoBinaryName</code></a> is used</p>
<h1 id="examples-52" class="section-header"><a href="#examples-52">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">arg_vec</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;my_prog&quot;</span>, <span class="string">&quot;some&quot;</span>, <span class="string">&quot;args&quot;</span>, <span class="string">&quot;to&quot;</span>, <span class="string">&quot;parse&quot;</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>(<span class="string">&quot;myprog&quot;</span>);
<span class="comment">// Args and options go here...</span>
<span class="kw">let</span> <span class="ident">matches</span> <span class="op">=</span> <span class="ident">app</span>.<span class="ident">get_matches_from_safe_borrow</span>(<span class="ident">arg_vec</span>)
.<span class="ident">unwrap_or_else</span>( <span class="op">|</span><span class="ident">e</span><span class="op">|</span> { <span class="macro">panic</span><span class="macro">!</span>(<span class="string">&quot;An error occurs: {}&quot;</span>, <span class="ident">e</span>) });</pre></div>
</div></div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Clone' class='impl'><code class='in-band'>impl&lt;'a, 'b&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</code><a href='#impl-Clone' class='anchor'></a><a class='srclink' href='../src/clap/app/mod.rs.html#1783-1785' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.clone' class="method hidden"><code id='clone.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; Self</code><a class='srclink' href='../src/clap/app/mod.rs.html#1784' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method hidden"><code id='clone_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#131-133' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-Display' class='impl'><code class='in-band'>impl&lt;'n, 'e&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'n, 'e&gt;</code><a href='#impl-Display' class='anchor'></a><a class='srclink' href='../src/clap/app/mod.rs.html#1837-1839' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../src/clap/app/mod.rs.html#1838' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-Sync' class='impl'><code class='in-band'>impl&lt;'a, 'b&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl&lt;'a, 'b&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl&lt;'a, 'b&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl&lt;'a, 'b&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl&lt;'a, 'b&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../clap/struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Into%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-Into%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#543-548' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -&gt; U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#545-547' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-ToString' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-ToString' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2134-2144' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.to_string' class="method hidden"><code id='to_string.v'>default fn <a href='https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string' class='fnname'>to_string</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2136-2143' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#552-554' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#553' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-ToOwned' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a href='#impl-ToOwned' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-92' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Owned' class="type"><code id='Owned.t'>type <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned' class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
</div><h4 id='method.to_owned' class="method hidden"><code id='to_owned.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned' class='fnname'>to_owned</a>(&amp;self) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#85-87' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
</div><h4 id='method.clone_into' class="method hidden"><code id='clone_into.v'>fn <a href='https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into' class='fnname'>clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T)</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89-91' title='goto source code'>[src]</a></h4><div class='stability hidden'><div class='stab unstable'><details><summary><span class='emoji'>🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
</div></div><h3 id='impl-TryFrom%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryFrom%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#571-577' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#574-576' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-TryInto%3CU%3E' class='impl'><code class='in-band'>impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-TryInto%3CU%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#559-566' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#563-565' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#218-220' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#219' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-215' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#100-102' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#101' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div></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><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</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><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "clap";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>