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


<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="rustdoc">

    <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=""></script>
<link rel="icon" type="image/x-icon" href="favicon.ico">

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

    <a href='' class='fork-me'>
  <img src='images/forkme.png'/>

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

    <div class="search">
        <form action=""
            <input name="q" class="search" placeholder="Search crates" type="text"/>

    <div class="nav">
        <a href=''>Browse All Crates</a>

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

        <div class="dropdown-container">
            <button class="dropdown">
                <span class="arrow"></span>
            <!-- Sync this list with
                 and with 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</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>


    <h1 class="title">Configuration</h1>
    <p>This document will explain how Cargo’s configuration system works, as well as
available keys or configuration.  For configuration of a project through its
manifest, see the <a href="manifest.html">manifest format</a>.</p>

<h1 id='hierarchical-structure' class='section-header'><a href='#hierarchical-structure'>Hierarchical structure</a></h1>
<p>Cargo allows to have local configuration for a particular project or global
configuration (like git). Cargo also extends this ability to a hierarchical
strategy. If, for example, Cargo were invoked in <code>/home/foo/bar/baz</code>, then the
following configuration files would be probed for:</p>


<p>With this structure you can specify local configuration per-project, and even
possibly check it into version control. You can also specify personal default
with a configuration file in your home directory.</p>

<h1 id='configuration-format' class='section-header'><a href='#configuration-format'>Configuration format</a></h1>
<p>All configuration is currently in the <a href="">TOML format</a> (like the manifest),
with simple key-value pairs inside of sections (tables) which all get merged

<h1 id='configuration-keys' class='section-header'><a href='#configuration-keys'>Configuration keys</a></h1>
<p>All of the following keys are optional, and their defaults are listed as their
value unless otherwise noted.</p>

<p>Key values that specify a tool may be given as an absolute path, a relative path
or as a pathless tool name. Absolute paths and pathless tool names are used as
given. Relative paths are resolved relative to the parent directory of the
<code>.cargo</code> directory of the config file that the value resides within.</p>

<pre><code class="language-toml"># An array of paths to local repositories which are to be used as overrides for
# dependencies. For more information see the Specifying Dependencies guide.
paths = [&quot;/path/to/override&quot;]

# This is your name/email to place in the `authors` section of a new Cargo.toml
# that is generated. If not present, then `git` will be probed, and if that is
# not present then `$USER` and `$EMAIL` will be used.
name = &quot;...&quot;
email = &quot;...&quot;

# By default `cargo new` will initialize a new Git repository. This key can be
# set to `hg` to create a Mercurial repository, or `none` to disable this
# behavior.
vcs = &quot;none&quot;

# For the following sections, $triple refers to any valid target triple, not the
# literal string &quot;$triple&quot;, and it will apply whenever that target triple is
# being compiled to. &#39;cfg(...)&#39; refers to the Rust-like `#[cfg]` syntax for
# conditional compilation.
# This is the linker which is passed to rustc (via `-C linker=`) when the `$triple`
# is being compiled for. By default this flag is not passed to the compiler.
linker = &quot;..&quot;
# Same but for the library archiver which is passed to rustc via `-C ar=`.
ar = &quot;..&quot;
# If a runner is provided, compiled targets for the `$triple` will be executed
# by invoking the specified runner executable with actual target as first argument.
# This applies to `cargo run`, `cargo test` and `cargo bench` commands.
# By default compiled targets are executed directly.
runner = &quot;..&quot;
# custom flags to pass to all compiler invocations that target $triple
# this value overrides build.rustflags when both are present
rustflags = [&quot;..&quot;, &quot;..&quot;]

# Similar for the $triple configuration, but using the `cfg` syntax.
# If several `cfg` and $triple targets are candidates, then the rustflags
# are concatenated. The `cfg` syntax only applies to rustflags, and not to
# linker.
rustflags = [&quot;..&quot;, &quot;..&quot;]

# Configuration keys related to the registry
index = &quot;...&quot;   # URL of the registry index (defaults to the central repository)
token = &quot;...&quot;   # Access token (found on the central repo’s website)

proxy = &quot;host:port&quot; # HTTP proxy to use for HTTP requests (defaults to none)
                    # in libcurl format, e.g. &quot;socks5h://host:port&quot;
timeout = 60000     # Timeout for each HTTP request, in milliseconds
cainfo = &quot;cert.pem&quot; # Path to Certificate Authority (CA) bundle (optional)
check-revoke = true # Indicates whether SSL certs are checked for revocation

jobs = 1                  # number of parallel jobs, defaults to # of CPUs
rustc = &quot;rustc&quot;           # the rust compiler tool
rustdoc = &quot;rustdoc&quot;       # the doc generator tool
target = &quot;triple&quot;         # build for the target triple
target-dir = &quot;target&quot;     # path of where to place all generated artifacts
rustflags = [&quot;..&quot;, &quot;..&quot;]  # custom flags to pass to all compiler invocations

verbose = false        # whether cargo provides verbose output
color = &#39;auto&#39;         # whether cargo colorizes output

# Network configuration
retry = 2 # number of times a network call will automatically retried

# Alias cargo commands. The first 3 aliases are built in. If your
# command requires grouped whitespace use the list format.
b = &quot;build&quot;
t = &quot;test&quot;
r = &quot;run&quot;
rr = &quot;run --release&quot;
space_example = [&quot;run&quot;, &quot;--release&quot;, &quot;--&quot;, &quot;\&quot;command list\&quot;&quot;]

<h1 id='environment-variables' class='section-header'><a href='#environment-variables'>Environment variables</a></h1>
<p>Cargo can also be configured through environment variables in addition to the
TOML syntax above. For each configuration key above of the form <code></code> the
environment variable <code>CARGO_FOO_BAR</code> can also be used to define the value. For
example the <code></code> key can also be defined by <code>CARGO_BUILD_JOBS</code>.</p>

<p>Environment variables will take precedent over TOML configuration, and currently
only integer, boolean, and string keys are supported to be defined by
environment variables.</p>

<p>In addition to the system above, Cargo recognizes a few other specific
<a href="environment-variables.html">environment variables</a>.</p>

<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>

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