Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > 878cdd00a13d17a73c6619a777ef5d74 > files > 55

rust-doc-1.19.0-1.mga6.x86_64.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">
    <meta name="description" content="API documentation for the Rust `alloc` crate.">
    <meta name="keywords" content="rust, rustlang, rust-lang, alloc">

    <title>alloc - Rust</title>

    <link rel="stylesheet" type="text/css" href="../normalize.css">
    <link rel="stylesheet" type="text/css" href="../rustdoc.css">
    <link rel="stylesheet" type="text/css" href="../main.css">
    

    <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico">
    
</head>
<body class="rustdoc mod">
    <!--[if lte IE 8]>
    <div class="warning">
        This old browser is unsupported and will most likely display funky
        things.
    </div>
    <![endif]-->

    

    <nav class="sidebar">
        <a href='../alloc/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a>
        <p class='location'>Crate alloc</p><div class="block items"><ul><li><a href="#reexports">Reexports</a></li><li><a href="#modules">Modules</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'alloc', ty: 'mod', relpath: '../'};</script>
    </nav>

    <nav class="sub">
        <form class="search-form js-only">
            <div class="search-container">
                <input class="search-input" name="search"
                       autocomplete="off"
                       placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
                       type="search">
            </div>
        </form>
    </nav>

    <section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Crate <a class="mod" href=''>alloc</a></span><span class='out-of-band'><span class='since' title='Stable since Rust version '></span><span id='render-detail'>
                   <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
                       [<span class='inner'>&#x2212;</span>]
                   </a>
               </span><a class='srclink' href='../src/alloc/lib.rs.html#11-135' title='goto source code'>[src]</a></span></h1>
<div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API.  (<code>alloc </code><a href="https://github.com/rust-lang/rust/issues/27783">#27783</a>)</summary><p>this library is unlikely to be stabilized in its current form or name</p>
</details></div></div><div class='docblock'>
<h1 id='the-rust-core-allocation-library' class='section-header'><a href='#the-rust-core-allocation-library'>The Rust core allocation library</a></h1>
<p>This is the lowest level library through which allocation in Rust can be
performed.</p>

<p>This library, like libcore, is not intended for general usage, but rather as
a building block of other libraries. The types and interfaces in this
library are reexported through the <a href="../std/index.html">standard library</a>,
and should not be used through this library.</p>

<p>Currently, there are four major definitions in this library.</p>

<h2 id='boxed-values' class='section-header'><a href='#boxed-values'>Boxed values</a></h2>
<p>The <a href="boxed/index.html"><code>Box</code></a> type is a smart pointer type. There can
only be one owner of a <code>Box</code>, and the owner can decide to mutate the
contents, which live on the heap.</p>

<p>This type can be sent among threads efficiently as the size of a <code>Box</code> value
is the same as that of a pointer. Tree-like data structures are often built
with boxes because each node often has only one owner, the parent.</p>

<h2 id='reference-counted-pointers' class='section-header'><a href='#reference-counted-pointers'>Reference counted pointers</a></h2>
<p>The <a href="rc/index.html"><code>Rc</code></a> type is a non-threadsafe reference-counted pointer
type intended for sharing memory within a thread. An <code>Rc</code> pointer wraps a
type, <code>T</code>, and only allows access to <code>&amp;T</code>, a shared reference.</p>

<p>This type is useful when inherited mutability (such as using <code>Box</code>) is too
constraining for an application, and is often paired with the <code>Cell</code> or
<code>RefCell</code> types in order to allow mutation.</p>

<h2 id='atomically-reference-counted-pointers' class='section-header'><a href='#atomically-reference-counted-pointers'>Atomically reference counted pointers</a></h2>
<p>The <a href="arc/index.html"><code>Arc</code></a> type is the threadsafe equivalent of the <code>Rc</code>
type. It provides all the same functionality of <code>Rc</code>, except it requires
that the contained type <code>T</code> is shareable. Additionally, <code>Arc&lt;T&gt;</code> is itself
sendable while <code>Rc&lt;T&gt;</code> is not.</p>

<p>This type allows for shared access to the contained data, and is often
paired with synchronization primitives such as mutexes to allow mutation of
shared resources.</p>

<h2 id='heap-interfaces' class='section-header'><a href='#heap-interfaces'>Heap interfaces</a></h2>
<p>The <a href="heap/index.html"><code>heap</code></a> module defines the low-level interface to the
default global allocator. It is not compatible with the libc allocator API.</p>
</div><h2 id='reexports' class='section-header'><a href="#reexports">Reexports</a></h2>
<table><tr><td><code>pub use oom::<a class="fn" href="../alloc/oom/fn.oom.html" title="fn alloc::oom::oom">oom</a>;</code></td></tr></table><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table>
                       <tr class=' module-item'>
                           <td><a class="mod" href="arc/index.html"
                                  title='mod alloc::arc'>arc</a></td>
                           <td class='docblock-short'>
                                <p>Thread-safe reference-counting pointers.</p>
                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="mod" href="boxed/index.html"
                                  title='mod alloc::boxed'>boxed</a></td>
                           <td class='docblock-short'>
                                <p>A pointer type for heap allocation.</p>
                           </td>
                       </tr>
                       <tr class=' module-item'>
                           <td><a class="mod" href="rc/index.html"
                                  title='mod alloc::rc'>rc</a></td>
                           <td class='docblock-short'>
                                <p>Single-threaded reference-counting pointers.</p>
                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="mod" href="heap/index.html"
                                  title='mod alloc::heap'>heap</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] 
                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="mod" href="oom/index.html"
                                  title='mod alloc::oom'>oom</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] 
                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="mod" href="raw_vec/index.html"
                                  title='mod alloc::raw_vec'>raw_vec</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] 
                           </td>
                       </tr>
                       <tr class='unstable module-item'>
                           <td><a class="mod" href="str/index.html"
                                  title='mod alloc::str'>str</a></td>
                           <td class='docblock-short'>
                               [<div class='stab unstable'>Experimental</div>] <p>Methods for dealing with boxed strings.</p>
                           </td>
                       </tr></table></section>
    <section id='search' class="content hidden"></section>

    <section class="footer"></section>

    <aside id="help" class="hidden">
        <div>
            <h1 class="hidden">Help</h1>

            <div class="shortcuts">
                <h2>Keyboard Shortcuts</h2>

                <dl>
                    <dt>?</dt>
                    <dd>Show this help dialog</dd>
                    <dt>S</dt>
                    <dd>Focus the search field</dd>
                    <dt>&larrb;</dt>
                    <dd>Move up in search results</dd>
                    <dt>&rarrb;</dt>
                    <dd>Move down in search results</dd>
                    <dt>&#9166;</dt>
                    <dd>Go to active search result</dd>
                    <dt>+</dt>
                    <dd>Collapse/expand all sections</dd>
                </dl>
            </div>

            <div class="infos">
                <h2>Search Tricks</h2>

                <p>
                    Prefix searches with a type followed by a colon (e.g.
                    <code>fn:</code>) to restrict the search to a given type.
                </p>

                <p>
                    Accepted types are: <code>fn</code>, <code>mod</code>,
                    <code>struct</code>, <code>enum</code>,
                    <code>trait</code>, <code>type</code>, <code>macro</code>,
                    and <code>const</code>.
                </p>

                <p>
                    Search functions by type signature (e.g.
                    <code>vec -> usize</code> or <code>* -> vec</code>)
                </p>
            </div>
        </div>
    </aside>

    

    <script>
        window.rootPath = "../";
        window.currentCrate = "alloc";
    </script>
    <script src="../main.js"></script>
    <script defer src="../search-index.js"></script>
</body>
</html>