<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>src/doc/man/includes/options-new.md - fork/cargo @ 0.90.0</title>
<meta name="description" content="src/doc/man/includes/options-new.md in fork/cargo at 0.90.0.">
<meta property="og:title" content="src/doc/man/includes/options-new.md - fork/cargo @ 0.90.0">
<meta property="og:description" content="src/doc/man/includes/options-new.md in fork/cargo at 0.90.0.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="0.90.0" data-tip="c24e1064277fe51ab72011e2612e556ac56addf7">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>fork/cargo</h1>
</div>
<pre class="clone">git clone https://git.julia.blue/fork/cargo</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">Eric Huss</span><span class="commit-message" data-commit="4c39aaff66862cc0da52fe529aa1990bb8bb9a22">feat: Stabilize Edition 2024 (#14828)</span><span class="snapshot-sha sha" data-commit="4c39aaff66862cc0da52fe529aa1990bb8bb9a22">4c39aaff6</span><time datetime="2024-11-25T16:36:17+00:00" title="2024-11-25 16:36:17 +0000">2024-11-25</time></p>
<header class="topbar"><details class="switcher"><summary>0.90.0</summary><div class="menu"><strong>branches</strong><a href="/fork/cargo/ref/master/">master</a><strong>tags</strong><a href="/fork/cargo/ref/0.87.0/">0.87.0</a><a href="/fork/cargo/ref/0.88.0/">0.88.0</a><a href="/fork/cargo/ref/0.89.0/">0.89.0</a><a class="current" href="/fork/cargo/ref/0.90.0/">0.90.0</a><a href="/fork/cargo/ref/0.91.0/">0.91.0</a><a href="/fork/cargo/ref/0.92.0/">0.92.0</a><a href="/fork/cargo/ref/0.93.0/">0.93.0</a><a href="/fork/cargo/ref/home-0.5.12/">home-0.5.12</a><a class="all" href="/fork/cargo/refs">all refs →</a></div></details><nav class="crumbs"><a href="/fork/cargo/">cargo</a> / <a href="/fork/cargo/ref/0.90.0/tree/src/">src</a> / <a href="/fork/cargo/ref/0.90.0/tree/src/doc/">doc</a> / <a href="/fork/cargo/ref/0.90.0/tree/src/doc/man/">man</a> / <a href="/fork/cargo/ref/0.90.0/tree/src/doc/man/includes/">includes</a> / <span class="cur">options-new.md</span></nav>
<span class="view-stats"><span>1.3 KiB</span><span>39 lines</span></span><span class="actions"><a class="raw" href="/fork/cargo/raw/5711f2420ad9ddeaa0477f121d6763d3f74e0ed0/src/doc/man/includes/options-new.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><p>{{#options}}</p>
<p>{{#option "<code>--bin</code>" }}
Create a package with a binary target (<code>src/main.rs</code>).
This is the default behavior.
{{/option}}</p>
<p>{{#option "<code>--lib</code>" }}
Create a package with a library target (<code>src/lib.rs</code>).
{{/option}}</p>
<p>{{#option "<code>--edition</code> <em>edition</em>" }}
Specify the Rust edition to use. Default is 2024.
Possible values: 2015, 2018, 2021, 2024
{{/option}}</p>
<p>{{#option "<code>--name</code> <em>name</em>" }}
Set the package name. Defaults to the directory name.
{{/option}}</p>
<p>{{#option "<code>--vcs</code> <em>vcs</em>" }}
Initialize a new VCS repository for the given version control system (git,
hg, pijul, or fossil) or do not initialize any version control at all
(none). If not specified, defaults to <code>git</code> or the configuration value
<code>cargo-new.vcs</code>, or <code>none</code> if already inside a VCS repository.
{{/option}}</p>
<p>{{#option "<code>--registry</code> <em>registry</em>" }}
This sets the <code>publish</code> field in <code>Cargo.toml</code> to the given registry name
which will restrict publishing only to that registry.</p>
<p>Registry names are defined in <a href="../reference/config.html">Cargo config files</a>.
If not specified, the default registry defined by the <code>registry.default</code>
config key is used. If the default registry is not set and <code>--registry</code> is not
used, the <code>publish</code> field will not be set which means that publishing will not
be restricted.
{{/option}}</p>
<p>{{/options}}</p>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text">{{#options}}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text">{{#option &quot;`--bin`&quot; }}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text">Create a package with a binary target (`src/main.rs`).</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text">This is the default behavior.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text">{{/option}}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text">{{#option &quot;`--lib`&quot; }}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text">Create a package with a library target (`src/lib.rs`).</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text">{{/option}}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text">{{#option &quot;`--edition` _edition_&quot; }}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text">Specify the Rust edition to use. Default is 2024.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text">Possible values: 2015, 2018, 2021, 2024</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text">{{/option}}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L16" href="#L16">16</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L17" href="#L17">17</a><span class="code-text">{{#option &quot;`--name` _name_&quot; }}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L18" href="#L18">18</a><span class="code-text">Set the package name. Defaults to the directory name.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L19" href="#L19">19</a><span class="code-text">{{/option}}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L20" href="#L20">20</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L21" href="#L21">21</a><span class="code-text">{{#option &quot;`--vcs` _vcs_&quot; }}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L22" href="#L22">22</a><span class="code-text">Initialize a new VCS repository for the given version control system (git,</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L23" href="#L23">23</a><span class="code-text">hg, pijul, or fossil) or do not initialize any version control at all</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L24" href="#L24">24</a><span class="code-text">(none). If not specified, defaults to `git` or the configuration value</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L25" href="#L25">25</a><span class="code-text">`cargo-new.vcs`, or `none` if already inside a VCS repository.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L26" href="#L26">26</a><span class="code-text">{{/option}}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L27" href="#L27">27</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L28" href="#L28">28</a><span class="code-text">{{#option &quot;`--registry` _registry_&quot; }}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L29" href="#L29">29</a><span class="code-text">This sets the `publish` field in `Cargo.toml` to the given registry name</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L30" href="#L30">30</a><span class="code-text">which will restrict publishing only to that registry.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L31" href="#L31">31</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L32" href="#L32">32</a><span class="code-text">Registry names are defined in [Cargo config files](../reference/config.html).</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L33" href="#L33">33</a><span class="code-text">If not specified, the default registry defined by the `registry.default`</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L34" href="#L34">34</a><span class="code-text">config key is used. If the default registry is not set and `--registry` is not</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L35" href="#L35">35</a><span class="code-text">used, the `publish` field will not be set which means that publishing will not</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L36" href="#L36">36</a><span class="code-text">be restricted.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L37" href="#L37">37</a><span class="code-text">{{/option}}</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L38" href="#L38">38</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L39" href="#L39">39</a><span class="code-text">{{/options}}</span></span></pre></div></div>
</main>
</body>
</html>
