blob: 7402c668df96bfbd6484452f002a27da31548bc0 [file] [log] [blame]
<!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="Used to create a representation of a command line program and all possible command line arguments. Application settings are set using the “builder pattern” with the `App::get_matches` 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)."><meta name="keywords" content="rust, rustlang, rust-lang, App"><title>App in clap - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../clap/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../clap/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">App</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.about">about</a></li><li><a href="#method.after_help">after_help</a></li><li><a href="#method.alias">alias</a></li><li><a href="#method.aliases">aliases</a></li><li><a href="#method.arg">arg</a></li><li><a href="#method.arg_from_usage">arg_from_usage</a></li><li><a href="#method.args">args</a></li><li><a href="#method.args_from_usage">args_from_usage</a></li><li><a href="#method.author">author</a></li><li><a href="#method.before_help">before_help</a></li><li><a href="#method.bin_name">bin_name</a></li><li><a href="#method.display_order">display_order</a></li><li><a href="#method.gen_completions">gen_completions</a></li><li><a href="#method.gen_completions_to">gen_completions_to</a></li><li><a href="#method.get_bin_name">get_bin_name</a></li><li><a href="#method.get_matches">get_matches</a></li><li><a href="#method.get_matches_from">get_matches_from</a></li><li><a href="#method.get_matches_from_safe">get_matches_from_safe</a></li><li><a href="#method.get_matches_from_safe_borrow">get_matches_from_safe_borrow</a></li><li><a href="#method.get_matches_safe">get_matches_safe</a></li><li><a href="#method.get_name">get_name</a></li><li><a href="#method.global_setting">global_setting</a></li><li><a href="#method.global_settings">global_settings</a></li><li><a href="#method.group">group</a></li><li><a href="#method.groups">groups</a></li><li><a href="#method.help">help</a></li><li><a href="#method.help_message">help_message</a></li><li><a href="#method.help_short">help_short</a></li><li><a href="#method.long_about">long_about</a></li><li><a href="#method.long_version">long_version</a></li><li><a href="#method.max_term_width">max_term_width</a></li><li><a href="#method.name">name</a></li><li><a href="#method.new">new</a></li><li><a href="#method.print_help">print_help</a></li><li><a href="#method.print_long_help">print_long_help</a></li><li><a href="#method.set_term_width">set_term_width</a></li><li><a href="#method.setting">setting</a></li><li><a href="#method.settings">settings</a></li><li><a href="#method.subcommand">subcommand</a></li><li><a href="#method.subcommands">subcommands</a></li><li><a href="#method.template">template</a></li><li><a href="#method.unset_setting">unset_setting</a></li><li><a href="#method.unset_settings">unset_settings</a></li><li><a href="#method.usage">usage</a></li><li><a href="#method.version">version</a></li><li><a href="#method.version_message">version_message</a></li><li><a href="#method.version_short">version_short</a></li><li><a href="#method.visible_alias">visible_alias</a></li><li><a href="#method.visible_aliases">visible_aliases</a></li><li><a href="#method.with_defaults">with_defaults</a></li><li><a href="#method.write_help">write_help</a></li><li><a href="#method.write_long_help">write_long_help</a></li><li><a href="#method.write_long_version">write_long_version</a></li><li><a href="#method.write_version">write_version</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Clone-for-App%3C%27a%2C%20%27b%3E">Clone</a></li><li><a href="#impl-Display-for-App%3C%27n%2C%20%27e%3E">Display</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-App%3C%27a%2C%20%27b%3E">!RefUnwindSafe</a></li><li><a href="#impl-Send-for-App%3C%27a%2C%20%27b%3E">!Send</a></li><li><a href="#impl-Sync-for-App%3C%27a%2C%20%27b%3E">!Sync</a></li><li><a href="#impl-Unpin-for-App%3C%27a%2C%20%27b%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-App%3C%27a%2C%20%27b%3E">!UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-App%3C%27a%2C%20%27b%3E">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-App%3C%27a%2C%20%27b%3E">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-App%3C%27a%2C%20%27b%3E">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-App%3C%27a%2C%20%27b%3E">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-App%3C%27a%2C%20%27b%3E">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-App%3C%27a%2C%20%27b%3E">ToOwned</a></li><li><a href="#impl-ToString-for-App%3C%27a%2C%20%27b%3E">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-App%3C%27a%2C%20%27b%3E">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-App%3C%27a%2C%20%27b%3E">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In clap</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="index.html">clap</a>::<wbr><a class="struct" href="#">App</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/clap/app/mod.rs.html#63-69">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct App&lt;'a, 'b&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;'a: 'b,</span>{ /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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 “builder pattern” 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 “options” that one must set. The “options” 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>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = App::new(<span class="string">&quot;My Program&quot;</span>)
.author(<span class="string">&quot;Me, me@mail.com&quot;</span>)
.version(<span class="string">&quot;1.0.2&quot;</span>)
.about(<span class="string">&quot;Explains in brief what the program does&quot;</span>)
.arg(
Arg::with_name(<span class="string">&quot;in_file&quot;</span>).index(<span class="number">1</span>)
)
.after_help(<span class="string">&quot;Longer explanation to appear after the options when \
displaying the help information from --help or -h&quot;</span>)
.get_matches();
<span class="comment">// Your program logic starts here...</span></code></pre></div>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#71-1651">source</a><a href="#impl-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; <a class="struct" href="struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#83-87">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>prog = App::new(<span class="string">&quot;My Program&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_name" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#90-92">source</a><h4 class="code-header">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></h4></section></summary><div class="docblock"><p>Get the name of the app</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_bin_name" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#95-97">source</a><h4 class="code-header">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;</h4></section></summary><div class="docblock"><p>Get the name of the binary</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.with_defaults" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#117-124">source</a><h4 class="code-header">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</h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 2.14.1: Can never work; use explicit App::author() and App::version() calls instead</span></div></span></summary><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>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>prog = App::with_defaults(<span class="string">&quot;My Program&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.author" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#190-193">source</a><h4 class="code-header">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</h4></section></summary><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/v2.33.1/examples"><code>examples/</code></a>
directory for more information</p>
<p>See the <a href="https://github.com/clap-rs/clap/tree/v2.33.1/examples"><code>examples/</code></a>
directory for more information</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.author(<span class="string">&quot;Me, me@mymain.com&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.bin_name" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#213-216">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;My Program&quot;</span>)
.bin_name(<span class="string">&quot;my_binary&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.about" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#236-239">source</a><h4 class="code-header">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</h4></section></summary><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="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>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.about(<span class="string">&quot;Does really amazing things to great people&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.long_about" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#262-265">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.long_about(
<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>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.name" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#289-292">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap ignore"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">let </span>yml = <span class="macro">load_yaml!</span>(<span class="string">&quot;app.yml&quot;</span>);
<span class="kw">let </span>app = App::from_yaml(yml)
.name(<span class="macro">crate_name!</span>());
<span class="comment">// continued logic goes here, such as `app.get_matches()` etc.</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.after_help" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#306-309">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.after_help(<span class="string">&quot;Does really amazing things to great people...but be careful with -R&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.before_help" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#323-326">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.before_help(<span class="string">&quot;Some info I&#39;d like to appear before the help info&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.version" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#349-352">source</a><h4 class="code-header">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</h4></section></summary><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/v2.33.1/examples"><code>examples/</code></a>
directory for more information</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.version(<span class="string">&quot;v0.1.24&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.long_version" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#380-383">source</a><h4 class="code-header">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</h4></section></summary><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/v2.33.1/examples"><code>examples/</code></a>
directory for more information</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.long_version(
<span class="string">&quot;v0.1.24
commit: abcdef89726d
revision: 123
release: 2
binary: myprog&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.usage" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#409-412">source</a><h4 class="code-header">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</h4></section></summary><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 “context-aware” 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 “USAGE: \n\t” 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>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.usage(<span class="string">&quot;myapp [-clDas] &lt;some_file&gt;&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.help" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#448-451">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myapp&quot;</span>)
.help(<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>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.help_short" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#474-477">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.help_short(<span class="string">&quot;H&quot;</span>) <span class="comment">// Using an uppercase `H` instead of the default lowercase `h`</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.version_short" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#500-503">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.version_short(<span class="string">&quot;v&quot;</span>) <span class="comment">// Using a lowercase `v` instead of the default capital `V`</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.help_message" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#520-523">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.help_message(<span class="string">&quot;Print help information&quot;</span>) <span class="comment">// Perhaps you want imperative help messages
</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.version_message" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#538-541">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.version_message(<span class="string">&quot;Print version information&quot;</span>) <span class="comment">// Perhaps you want imperative help messages</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.template" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#582-585">source</a><h4 class="code-header">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</h4></section></summary><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 “best effort”</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>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.version(<span class="string">&quot;1.0&quot;</span>)
.template(<span class="string">&quot;{bin} ({version}) - {usage}&quot;</span>)</code></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></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.setting" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#602-605">source</a><h4 class="code-header">pub fn <a href="#method.setting" class="fnname">setting</a>(self, setting: <a class="enum" href="enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a>) -&gt; Self</h4></section></summary><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>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.setting(AppSettings::SubcommandRequired)
.setting(AppSettings::WaitOnError)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.settings" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#622-627">source</a><h4 class="code-header">pub fn <a href="#method.settings" class="fnname">settings</a>(self, settings: &amp;[<a class="enum" href="enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a>]) -&gt; Self</h4></section></summary><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>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.settings(<span class="kw-2">&amp;</span>[AppSettings::SubcommandRequired,
AppSettings::WaitOnError])</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.global_setting" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#645-649">source</a><h4 class="code-header">pub fn <a href="#method.global_setting" class="fnname">global_setting</a>(self, setting: <a class="enum" href="enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a>) -&gt; Self</h4></section></summary><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>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.global_setting(AppSettings::SubcommandRequired)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.global_settings" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#668-674">source</a><h4 class="code-header">pub fn <a href="#method.global_settings" class="fnname">global_settings</a>(self, settings: &amp;[<a class="enum" href="enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a>]) -&gt; Self</h4></section></summary><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>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.global_settings(<span class="kw-2">&amp;</span>[AppSettings::SubcommandRequired,
AppSettings::ColoredHelp])</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.unset_setting" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#690-693">source</a><h4 class="code-header">pub fn <a href="#method.unset_setting" class="fnname">unset_setting</a>(self, setting: <a class="enum" href="enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a>) -&gt; Self</h4></section></summary><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>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.unset_setting(AppSettings::ColorAuto)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.unset_settings" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#710-715">source</a><h4 class="code-header">pub fn <a href="#method.unset_settings" class="fnname">unset_settings</a>(self, settings: &amp;[<a class="enum" href="enum.AppSettings.html" title="enum clap::AppSettings">AppSettings</a>]) -&gt; Self</h4></section></summary><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>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.unset_settings(<span class="kw-2">&amp;</span>[AppSettings::ColorAuto,
AppSettings::AllowInvalidUtf8])</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_term_width" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#742-745">source</a><h4 class="code-header">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</h4></section></summary><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 “feature” 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>
<h5 id="platform-specific"><a href="#platform-specific">Platform Specific</a></h5>
<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>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.set_term_width(<span class="number">80</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.max_term_width" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#770-773">source</a><h4 class="code-header">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</h4></section></summary><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 “feature” 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>
<h5 id="platform-specific-1"><a href="#platform-specific-1">Platform Specific</a></h5>
<p>Only Unix, Linux, macOS and Windows support automatic determination of terminal width.</p>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.max_term_width(<span class="number">100</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.arg" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#796-799">source</a><h4 class="code-header">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="struct.Arg.html" title="struct clap::Arg">Arg</a>&lt;'a, 'b&gt;&gt;&gt;(self, a: A) -&gt; Self</h4></section></summary><div class="docblock"><p>Adds an <a href="./struct.Arg.html">argument</a> to the list of valid possibilities.</p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<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>.arg(
Arg::with_name(<span class="string">&quot;debug&quot;</span>)
.short(<span class="string">&quot;d&quot;</span>)
.help(<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
// verbose Arg::from_usage()
</span>.arg(
Arg::from_usage(<span class="string">&quot;-c --config=[CONFIG] &#39;Optionally sets a config file to use&#39;&quot;</span>)
)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.args" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#815-820">source</a><h4 class="code-header">pub fn <a href="#method.args" class="fnname">args</a>(self, args: &amp;[<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>&lt;'a, 'b&gt;]) -&gt; Self</h4></section></summary><div class="docblock"><p>Adds multiple <a href="./struct.Arg.html">arguments</a> to the list of valid possibilities</p>
<h5 id="examples-28"><a href="#examples-28">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.args(
<span class="kw-2">&amp;</span>[Arg::from_usage(<span class="string">&quot;[debug] -d &#39;turns on debugging info&#39;&quot;</span>),
Arg::with_name(<span class="string">&quot;input&quot;</span>).index(<span class="number">1</span>).help(<span class="string">&quot;the input file to use&quot;</span>)]
)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.arg_from_usage" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#839-842">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-29"><a href="#examples-29">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.arg_from_usage(<span class="string">&quot;-c --config=&lt;FILE&gt; &#39;Sets a configuration file to use&#39;&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.args_from_usage" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#866-875">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-30"><a href="#examples-30">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.args_from_usage(
<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>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.alias" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#893-900">source</a><h4 class="code-header">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</h4></section></summary><div class="docblock"><p>Allows adding a <a href="./struct.SubCommand.html"><code>SubCommand</code></a> alias, which function as “hidden” 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>
<h5 id="examples-31"><a href="#examples-31">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = App::new(<span class="string">&quot;myprog&quot;</span>)
.subcommand(SubCommand::with_name(<span class="string">&quot;test&quot;</span>)
.alias(<span class="string">&quot;do-stuff&quot;</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;do-stuff&quot;</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">&quot;test&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.aliases" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#922-931">source</a><h4 class="code-header">pub fn <a href="#method.aliases" class="fnname">aliases</a>(self, names: &amp;[&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>]) -&gt; Self</h4></section></summary><div class="docblock"><p>Allows adding <a href="./struct.SubCommand.html"><code>SubCommand</code></a> aliases, which function as “hidden” 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>
<h5 id="examples-32"><a href="#examples-32">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = App::new(<span class="string">&quot;myprog&quot;</span>)
.subcommand(SubCommand::with_name(<span class="string">&quot;test&quot;</span>)
.aliases(<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>]))
.arg(Arg::with_name(<span class="string">&quot;input&quot;</span>)
.help(<span class="string">&quot;the file to add&quot;</span>)
.index(<span class="number">1</span>)
.required(<span class="bool-val">false</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;do-tests&quot;</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">&quot;test&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.visible_alias" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#948-955">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-33"><a href="#examples-33">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = App::new(<span class="string">&quot;myprog&quot;</span>)
.subcommand(SubCommand::with_name(<span class="string">&quot;test&quot;</span>)
.visible_alias(<span class="string">&quot;do-stuff&quot;</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;do-stuff&quot;</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">&quot;test&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.visible_aliases" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#972-981">source</a><h4 class="code-header">pub fn <a href="#method.visible_aliases" class="fnname">visible_aliases</a>(self, names: &amp;[&amp;'b <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>]) -&gt; Self</h4></section></summary><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>
<h5 id="examples-34"><a href="#examples-34">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = App::new(<span class="string">&quot;myprog&quot;</span>)
.subcommand(SubCommand::with_name(<span class="string">&quot;test&quot;</span>)
.visible_aliases(<span class="kw-2">&amp;</span>[<span class="string">&quot;do-stuff&quot;</span>, <span class="string">&quot;tests&quot;</span>]))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;do-stuff&quot;</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">&quot;test&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.group" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1017-1020">source</a><h4 class="code-header">pub fn <a href="#method.group" class="fnname">group</a>(self, group: <a class="struct" href="struct.ArgGroup.html" title="struct clap::ArgGroup">ArgGroup</a>&lt;'a&gt;) -&gt; Self</h4></section></summary><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>
<h5 id="examples-35"><a href="#examples-35">Examples</a></h5>
<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"><code>App::new(<span class="string">&quot;app&quot;</span>)
.args_from_usage(
<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>)
.group(ArgGroup::with_name(<span class="string">&quot;vers&quot;</span>)
.args(<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>])
.required(<span class="bool-val">true</span>))</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.groups" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1047-1052">source</a><h4 class="code-header">pub fn <a href="#method.groups" class="fnname">groups</a>(self, groups: &amp;[<a class="struct" href="struct.ArgGroup.html" title="struct clap::ArgGroup">ArgGroup</a>&lt;'a&gt;]) -&gt; Self</h4></section></summary><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>
<h5 id="examples-36"><a href="#examples-36">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;app&quot;</span>)
.args_from_usage(
<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>)
.groups(<span class="kw-2">&amp;</span>[
ArgGroup::with_name(<span class="string">&quot;vers&quot;</span>)
.args(<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>])
.required(<span class="bool-val">true</span>),
ArgGroup::with_name(<span class="string">&quot;input&quot;</span>)
.args(<span class="kw-2">&amp;</span>[<span class="string">&quot;c&quot;</span>, <span class="string">&quot;i&quot;</span>])
])</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.subcommand" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1071-1074">source</a><h4 class="code-header">pub fn <a href="#method.subcommand" class="fnname">subcommand</a>(self, subcmd: <a class="struct" href="struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;) -&gt; Self</h4></section></summary><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>
<h5 id="examples-37"><a href="#examples-37">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>App::new(<span class="string">&quot;myprog&quot;</span>)
.subcommand(SubCommand::with_name(<span class="string">&quot;config&quot;</span>)
.about(<span class="string">&quot;Controls configuration features&quot;</span>)
.arg_from_usage(<span class="string">&quot;&lt;config&gt; &#39;Required configuration file to use&#39;&quot;</span>))</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.subcommands" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1092-1100">source</a><h4 class="code-header">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="struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;&gt;,</span></h4></section></summary><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>
<h5 id="examples-38"><a href="#examples-38">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>.subcommands( <span class="macro">vec!</span>[
SubCommand::with_name(<span class="string">&quot;config&quot;</span>).about(<span class="string">&quot;Controls configuration functionality&quot;</span>)
.arg(Arg::with_name(<span class="string">&quot;config_file&quot;</span>).index(<span class="number">1</span>)),
SubCommand::with_name(<span class="string">&quot;debug&quot;</span>).about(<span class="string">&quot;Controls debug functionality&quot;</span>)])</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.display_order" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1149-1152">source</a><h4 class="code-header">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</h4></section></summary><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>
<h5 id="examples-39"><a href="#examples-39">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = App::new(<span class="string">&quot;cust-ord&quot;</span>)
.subcommand(SubCommand::with_name(<span class="string">&quot;alpha&quot;</span>) <span class="comment">// typically subcommands are grouped
// alphabetically by name. Subcommands
// without a display_order have a value of
// 999 and are displayed alphabetically with
// all other 999 subcommands
</span>.about(<span class="string">&quot;Some help and text&quot;</span>))
.subcommand(SubCommand::with_name(<span class="string">&quot;beta&quot;</span>)
.display_order(<span class="number">1</span>) <span class="comment">// In order to force this subcommand to appear *first*
// all we have to do is give it a value lower than 999.
// Any other subcommands with a value of 1 will be displayed
// alphabetically with this one...then 2 values, then 3, etc.
</span>.about(<span class="string">&quot;I should be first!&quot;</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">&quot;cust-ord&quot;</span>, <span class="string">&quot;--help&quot;
</span>]);</code></pre></div>
<p>The above example displays the following help message</p>
<div class="example-wrap"><pre class="language-text"><code>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></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.print_help" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1171-1182">source</a><h4 class="code-header">pub fn <a href="#method.print_help" class="fnname">print_help</a>(&amp;mut self) -&gt; <a class="type" href="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;</h4></section></summary><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 “short” and “long” 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>
<h5 id="examples-40"><a href="#examples-40">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>app = App::new(<span class="string">&quot;myprog&quot;</span>);
app.print_help();</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.print_long_help" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1201-1205">source</a><h4 class="code-header">pub fn <a href="#method.print_long_help" class="fnname">print_long_help</a>(&amp;mut self) -&gt; <a class="type" href="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;</h4></section></summary><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 “short” and “long” 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>
<h5 id="examples-41"><a href="#examples-41">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>app = App::new(<span class="string">&quot;myprog&quot;</span>);
app.print_long_help();</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.write_help" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1229-1240">source</a><h4 class="code-header">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="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;</h4></section></summary><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 “short” and “long” 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="struct.App.html#method.write_long_help" title="App::write_long_help"><code>App::write_long_help</code></a> instead if possible!</p>
<h5 id="examples-42"><a href="#examples-42">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">let </span><span class="kw-2">mut </span>app = App::new(<span class="string">&quot;myprog&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>out = io::stdout();
app.write_help(<span class="kw-2">&amp;mut </span>out).expect(<span class="string">&quot;failed to write to stdout&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.write_long_help" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1260-1269">source</a><h4 class="code-header">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="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;</h4></section></summary><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 “short” and “long” 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>
<h5 id="examples-43"><a href="#examples-43">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">let </span><span class="kw-2">mut </span>app = App::new(<span class="string">&quot;myprog&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>out = io::stdout();
app.write_long_help(<span class="kw-2">&amp;mut </span>out).expect(<span class="string">&quot;failed to write to stdout&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.write_version" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1288-1290">source</a><h4 class="code-header">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="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;</h4></section></summary><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 “short” and “long” 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>
<h5 id="examples-44"><a href="#examples-44">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">let </span><span class="kw-2">mut </span>app = App::new(<span class="string">&quot;myprog&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>out = io::stdout();
app.write_version(<span class="kw-2">&amp;mut </span>out).expect(<span class="string">&quot;failed to write to stdout&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.write_long_version" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1309-1311">source</a><h4 class="code-header">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="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;</h4></section></summary><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 “short” and “long” 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>
<h5 id="examples-45"><a href="#examples-45">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">let </span><span class="kw-2">mut </span>app = App::new(<span class="string">&quot;myprog&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>out = io::stdout();
app.write_long_version(<span class="kw-2">&amp;mut </span>out).expect(<span class="string">&quot;failed to write to stdout&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.gen_completions" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1396-1404">source</a><h4 class="code-header">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="enum.Shell.html" title="enum clap::Shell">Shell</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;out_dir: T<br>)</h4></section></summary><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> “Build Script”</p>
<h5 id="examples-46"><a href="#examples-46">Examples</a></h5>
<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"><code><span class="comment">// src/cli.rs
</span><span class="kw">use </span>clap::{App, Arg, SubCommand};
<span class="kw">pub fn </span>build_cli() -&gt; App&lt;<span class="lifetime">&#39;static</span>, <span class="lifetime">&#39;static</span>&gt; {
App::new(<span class="string">&quot;compl&quot;</span>)
.about(<span class="string">&quot;Tests completions&quot;</span>)
.arg(Arg::with_name(<span class="string">&quot;file&quot;</span>)
.help(<span class="string">&quot;some input file&quot;</span>))
.subcommand(SubCommand::with_name(<span class="string">&quot;test&quot;</span>)
.about(<span class="string">&quot;tests things&quot;</span>)
.arg(Arg::with_name(<span class="string">&quot;case&quot;</span>)
.long(<span class="string">&quot;case&quot;</span>)
.takes_value(<span class="bool-val">true</span>)
.help(<span class="string">&quot;the case to test&quot;</span>)))
}</code></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="example-wrap ignore"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="comment">// src/main.rs
</span><span class="kw">mod </span>cli;
<span class="kw">fn </span>main() {
<span class="kw">let </span>m = cli::build_cli().get_matches();
<span class="comment">// normal logic continues...
</span>}</code></pre></div>
<p>Next, we set up our <code>Cargo.toml</code> to use a <code>build.rs</code> build script.</p>
<div class="example-wrap"><pre class="language-toml"><code>build = &quot;build.rs&quot;
[build-dependencies]
clap = &quot;2.23&quot;</code></pre></div>
<p>Next, we place a <code>build.rs</code> in our project root.</p>
<div class="example-wrap ignore"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">extern crate </span>clap;
<span class="kw">use </span>clap::Shell;
<span class="macro">include!</span>(<span class="string">&quot;src/cli.rs&quot;</span>);
<span class="kw">fn </span>main() {
<span class="kw">let </span>outdir = <span class="kw">match </span>env::var_os(<span class="string">&quot;OUT_DIR&quot;</span>) {
<span class="prelude-val">None </span>=&gt; <span class="kw">return</span>,
<span class="prelude-val">Some</span>(outdir) =&gt; outdir,
};
<span class="kw">let </span><span class="kw-2">mut </span>app = build_cli();
app.gen_completions(<span class="string">&quot;myapp&quot;</span>, <span class="comment">// We need to specify the bin name manually
</span>Shell::Bash, <span class="comment">// Then say which shell to build completions for
</span>outdir); <span class="comment">// Then say where write the completions to
</span>}</code></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></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.gen_completions_to" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1438-1446">source</a><h4 class="code-header">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="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>)</h4></section></summary><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>
<h5 id="examples-47"><a href="#examples-47">Examples</a></h5>
<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="example-wrap ignore"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="comment">// src/main.rs
</span><span class="kw">mod </span>cli;
<span class="kw">use </span>std::io;
<span class="kw">fn </span>main() {
<span class="kw">let </span>matches = cli::build_cli().get_matches();
<span class="kw">if </span>matches.is_present(<span class="string">&quot;generate-bash-completions&quot;</span>) {
cli::build_cli().gen_completions_to(<span class="string">&quot;myapp&quot;</span>, Shell::Bash, <span class="kw-2">&amp;mut </span>io::stdout());
}
<span class="comment">// normal logic continues...
</span>}
</code></pre></div>
<p>Usage:</p>
<div class="example-wrap"><pre class="language-shell"><code>$ myapp generate-bash-completions &gt; /usr/share/bash-completion/completions/myapp.bash</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_matches" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1462-1464">source</a><h4 class="code-header">pub fn <a href="#method.get_matches" class="fnname">get_matches</a>(self) -&gt; <a class="struct" href="struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>&lt;'a&gt;</h4></section></summary><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>
<h5 id="examples-48"><a href="#examples-48">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>matches = App::new(<span class="string">&quot;myprog&quot;</span>)
<span class="comment">// Args and options go here...
</span>.get_matches();</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_matches_safe" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1491-1494">source</a><h4 class="code-header">pub fn <a href="#method.get_matches_safe" class="fnname">get_matches_safe</a>(self) -&gt; <a class="type" href="type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="struct" href="struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>&lt;'a&gt;&gt;</h4></section></summary><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>
<h5 id="examples-49"><a href="#examples-49">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>matches = App::new(<span class="string">&quot;myprog&quot;</span>)
<span class="comment">// Args and options go here...
</span>.get_matches_safe()
.unwrap_or_else( |e| e.exit() );</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_matches_from" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1517-1540">source</a><h4 class="code-header">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="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>,</span></h4></section></summary><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>
<h5 id="examples-50"><a href="#examples-50">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arg_vec = <span class="macro">vec!</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>matches = App::new(<span class="string">&quot;myprog&quot;</span>)
<span class="comment">// Args and options go here...
</span>.get_matches_from(arg_vec);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_matches_from_safe" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1574-1580">source</a><h4 class="code-header">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="type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="struct" href="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>,</span></h4></section></summary><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>
<h5 id="examples-51"><a href="#examples-51">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arg_vec = <span class="macro">vec!</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>matches = App::new(<span class="string">&quot;myprog&quot;</span>)
<span class="comment">// Args and options go here...
</span>.get_matches_from_safe(arg_vec)
.unwrap_or_else( |e| { <span class="macro">panic!</span>(<span class="string">&quot;An error occurs: {}&quot;</span>, e) });</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_matches_from_safe_borrow" class="method has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1603-1650">source</a><h4 class="code-header">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="type.Result.html" title="type clap::Result">ClapResult</a>&lt;<a class="struct" href="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>,</span></h4></section></summary><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>
<h5 id="examples-52"><a href="#examples-52">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arg_vec = <span class="macro">vec!</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>app = App::new(<span class="string">&quot;myprog&quot;</span>);
<span class="comment">// Args and options go here...
</span><span class="kw">let </span>matches = app.get_matches_from_safe_borrow(arg_vec)
.unwrap_or_else( |e| { <span class="macro">panic!</span>(<span class="string">&quot;An error occurs: {}&quot;</span>, e) });</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Clone-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1801-1805">source</a><a href="#impl-Clone-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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="struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1802-1804">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; Self</h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="rightside"><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#132-134">source</a></span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const 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)</h4></section></summary><div class='docblock'>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></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Display-for-App%3C%27n%2C%20%27e%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1905-1909">source</a><a href="#impl-Display-for-App%3C%27n%2C%20%27e%3E" class="anchor"></a><h3 class="code-header">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="struct.App.html" title="struct clap::App">App</a>&lt;'n, 'e&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/clap/app/mod.rs.html#1906-1908">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">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>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>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></div></details></div></details></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"><section id="impl-RefUnwindSafe-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</h3></section><section id="impl-Send-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-Send-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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="struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</h3></section><section id="impl-Sync-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-Sync-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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="struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</h3></section><section id="impl-Unpin-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-Unpin-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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="struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</h3></section><section id="impl-UnwindSafe-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a href="#impl-UnwindSafe-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'b&gt; !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.App.html" title="struct clap::App">App</a>&lt;'a, 'b&gt;</h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#200">source</a><a href="#impl-Any-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#201">source</a><a href="#method.type_id" class="anchor"></a><h4 class="code-header">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></h4></section></summary><div class='docblock'>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></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#211">source</a><a href="#impl-Borrow%3CT%3E-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213">source</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">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</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220">source</a><a href="#impl-BorrowMut%3CT%3E-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221">source</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">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</h4></section></summary><div class='docblock'>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></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#733">source</a><a href="#impl-From%3CT%3E-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#736">source</a></span><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#717">source</a><a href="#impl-Into%3CU%3E-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#725">source</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#83">source</a><a href="#impl-ToOwned-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">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</h4></section></summary><div class='docblock'>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></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">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)</h4></section></summary><div class='docblock'>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></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToString-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2497">source</a><a href="#impl-ToString-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2503">source</a><a href="#method.to_string" class="anchor"></a><h4 class="code-header">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></h4></section></summary><div class='docblock'>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></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#775">source</a><a href="#impl-TryFrom%3CU%3E-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#781">source</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">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="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-App%3C%27a%2C%20%27b%3E" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#760">source</a><a href="#impl-TryInto%3CU%3E-for-App%3C%27a%2C%20%27b%3E" class="anchor"></a><h3 class="code-header">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;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">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="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#766">source</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">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="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="clap" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>