Sophie

Sophie

distrib > Mageia > 6 > x86_64 > by-pkgid > 3dd7afb0e73ef085f903dd0db1dc8c8f > files > 24

cargo-doc-0.22.0-1.mga6.noarch.rpm

<!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">
    <title>Package ID Specifications</title>

    <link rel="stylesheet" type="text/css" href="stylesheets/normalize.css">
<link rel="stylesheet" type="text/css" href="stylesheets/all.css">
<link rel="stylesheet" type="text/css" href="stylesheets/prism.css">

    <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<link rel="icon" type="image/x-icon" href="favicon.ico">


</head>
<body class="rustdoc">
    <!--[if lte IE 8]>
    <div class="warning">
        This old browser is unsupported and will most likely display funky
        things.
    </div>
    <![endif]-->

    <a href='https://github.com/rust-lang/cargo' class='fork-me'>
  <img src='images/forkme.png'/>
</a>

<div id="header">
    <a href='https://crates.io' class='logo'>
        <img id="logo" height=100 width=100 src='images/Cargo-Logo-Small.png'/>
    </a>
    <a href="index.html">
        <h1>CARGO</h1>
    </a>

    <div class="search">
        <form action="https://crates.io/search"
              method="GET">
            <input name="q" class="search" placeholder="Search crates" type="text"/>
        </form>
    </div>

    <div class="nav">
        <a href='https://crates.io/crates'>Browse All Crates</a>

        <span class='sep'>|</span>

        <div class="dropdown-container">
            <button class="dropdown">
                Docs
                <span class="arrow"></span>
            </button>
            <!-- Sync this list with
                 https://github.com/rust-lang/crates.io/blob/master/app/templates/application.hbs
                 and with Makefile.in in this repository -->
            <ul id="current-user-links" class="dropdown" data-bindattr-503="503">
                <li><a href='index.html'>Getting Started</a></li>
                <li><a href='guide.html'>Guide</a></li>
                <li><a href='specifying-dependencies.html'>Specifying Dependencies</a></li>
                <li><a href='crates-io.html'>Publishing on crates.io</a></li>
                <li><a href='faq.html'>FAQ</a></li>
                <li><a href='manifest.html'>Cargo.toml Format</a></li>
                <li><a href='build-script.html'>Build Scripts</a></li>
                <li><a href='config.html'>Configuration</a></li>
                <li><a href='pkgid-spec.html'>Package ID specs</a></li>
                <li><a href='environment-variables.html'>Environment Variables</a></li>
                <li><a href='source-replacement.html'>Source Replacement</a></li>
                <li><a href='external-tools.html'>External Tools</a></li>
                <li><a href='policies.html'>Policies</a></li>
            </ul>
        </div>
    </div>
</div>

<main>


    <h1 class="title">Package ID Specifications</h1>
    
<h1 id='package-id-specifications' class='section-header'><a href='#package-id-specifications'>Package ID specifications</a></h1>
<p>Subcommands of Cargo frequently need to refer to a particular package within a
dependency graph for various operations like updating, cleaning, building, etc.
To solve this problem, Cargo supports Package ID Specifications. A specification
is a string which is used to uniquely refer to one package within a graph of
packages.</p>

<h2 id='specification-grammar' class='section-header'><a href='#specification-grammar'>Specification grammar</a></h2>
<p>The formal grammar for a Package Id Specification is:</p>

<pre><code class="language-notrust">pkgid := pkgname
       | [ proto &quot;://&quot; ] hostname-and-path [ &quot;#&quot; ( pkgname | semver ) ]
pkgname := name [ &quot;:&quot; semver ]

proto := &quot;http&quot; | &quot;git&quot; | ...
</code></pre>

<p>Here, brackets indicate that the contents are optional.</p>

<h2 id='example-specifications' class='section-header'><a href='#example-specifications'>Example specifications</a></h2>
<p>These could all be references to a package <code>foo</code> version <code>1.2.3</code> from the
registry at <code>crates.io</code></p>

<table>
<thead>
<tr>
<th style="text-align: right">pkgid</th>
<th style="text-align: center">name</th>
<th style="text-align: center">version</th>
<th style="text-align: center">url</th>
</tr>
</thead>

<tbody>
<tr>
<td style="text-align: right"><code>foo</code></td>
<td style="text-align: center">foo</td>
<td style="text-align: center">*</td>
<td style="text-align: center">*</td>
</tr>
<tr>
<td style="text-align: right"><code>foo:1.2.3</code></td>
<td style="text-align: center">foo</td>
<td style="text-align: center">1.2.3</td>
<td style="text-align: center">*</td>
</tr>
<tr>
<td style="text-align: right"><code>crates.io/foo</code></td>
<td style="text-align: center">foo</td>
<td style="text-align: center">*</td>
<td style="text-align: center">*://crates.io/foo</td>
</tr>
<tr>
<td style="text-align: right"><code>crates.io/foo#1.2.3</code></td>
<td style="text-align: center">foo</td>
<td style="text-align: center">1.2.3</td>
<td style="text-align: center">*://crates.io/foo</td>
</tr>
<tr>
<td style="text-align: right"><code>crates.io/bar#foo:1.2.3</code></td>
<td style="text-align: center">foo</td>
<td style="text-align: center">1.2.3</td>
<td style="text-align: center">*://crates.io/bar</td>
</tr>
<tr>
<td style="text-align: right"><code>http://crates.io/foo#1.2.3</code></td>
<td style="text-align: center">foo</td>
<td style="text-align: center">1.2.3</td>
<td style="text-align: center"><a href="http://crates.io/foo">http://crates.io/foo</a></td>
</tr>
</tbody>
</table>

<h2 id='brevity-of-specifications' class='section-header'><a href='#brevity-of-specifications'>Brevity of specifications</a></h2>
<p>The goal of this is to enable both succinct and exhaustive syntaxes for
referring to packages in a dependency graph. Ambiguous references may refer to
one or more packages. Most commands generate an error if more than one package
could be referred to with the same specification.</p>

    </main>
<footer>
<a href='index.html'>Install</a>
<span class='sep'>|</span>
<a href='index.html'>Getting Started</a>
<span class='sep'>|</span>
<a href='guide.html'>Guide</a>
</footer>

<script type='text/javascript' src='javascripts/prism.js'></script>
<script type='text/javascript' src='javascripts/all.js'></script>


</body>
</html>