<!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 `System` struct in crate `std`."> <meta name="keywords" content="rust, rustlang, rust-lang, System"> <title>std::heap::System - Rust</title> <link rel="stylesheet" type="text/css" href="../../normalize.css"> <link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"> <link rel="stylesheet" type="text/css" href="../../dark.css"> <link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle"> <script src="../../storage.js"></script> <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"> </head> <body class="rustdoc struct"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <nav class="sidebar"> <div class="sidebar-menu">☰</div> <a href='../../std/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a> <p class='location'>Struct System</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Alloc">Alloc</a></div></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>heap</a></p><script>window.sidebarCurrent = {name: 'System', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div> </nav> <div class="theme-picker"> <button id="theme-picker" aria-label="Pick another theme!"> <img src="../../brush.svg" width="18" alt="Pick another theme!"> </button> <div id="theme-choices"></div> </div> <script src="../../theme.js"></script> <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'>Struct <a href='../index.html'>std</a>::<wbr><a href='index.html'>heap</a>::<wbr><a class="struct" href=''>System</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'>−</span>] </a> </span></span></h1> <pre class='rust struct'>pub struct System;</pre><div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</div></div> <h2 id='implementations' class='small-section-header'> Trait Implementations<a href='#implementations' class='anchor'></a> </h2> <h3 id='impl-Alloc' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/heap/trait.Alloc.html" title="trait std::heap::Alloc">Alloc</a> for <a class="struct" href="../../std/heap/struct.System.html" title="struct std::heap::System">System</a></code><a href='#impl-Alloc' class='anchor'></a></span><span class='out-of-band'></span></h3> <div class='impl-items'><h4 id='method.alloc' class="method"><span id='alloc.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#tymethod.alloc' class='fnname'>alloc</a>(&mut self, layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Returns a pointer meeting the size and alignment guarantees of <code>layout</code>. <a href="../../std/heap/trait.Alloc.html#tymethod.alloc">Read more</a></p> </div><h4 id='method.alloc_zeroed' class="method"><span id='alloc_zeroed.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.alloc_zeroed' class='fnname'>alloc_zeroed</a>(&mut self, layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Behaves like <code>alloc</code>, but also ensures that the contents are set to zero before being returned. <a href="../../std/heap/trait.Alloc.html#method.alloc_zeroed">Read more</a></p> </div><h4 id='method.dealloc' class="method"><span id='dealloc.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#tymethod.dealloc' class='fnname'>dealloc</a>(&mut self, ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>)</code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Deallocate the memory referenced by <code>ptr</code>. <a href="../../std/heap/trait.Alloc.html#tymethod.dealloc">Read more</a></p> </div><h4 id='method.realloc' class="method"><span id='realloc.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.realloc' class='fnname'>realloc</a>(<br> &mut self, <br> ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <br> old_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>, <br> new_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Returns a pointer suitable for holding data described by <code>new_layout</code>, meeting its size and alignment guarantees. To accomplish this, this may extend or shrink the allocation referenced by <code>ptr</code> to fit <code>new_layout</code>. <a href="../../std/heap/trait.Alloc.html#method.realloc">Read more</a></p> </div><h4 id='method.oom' class="method"><span id='oom.v' class='invisible'><code>fn <a href='../../std/heap/trait.Alloc.html#method.oom' class='fnname'>oom</a>(&mut self, err: <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>) -> <a class="primitive" href="../primitive.never.html">!</a></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Allocator-specific method for signaling an out-of-memory condition. <a href="../../std/heap/trait.Alloc.html#method.oom">Read more</a></p> </div><h4 id='method.usable_size' class="method"><span id='usable_size.v' class='invisible'><code>fn <a href='../../std/heap/trait.Alloc.html#method.usable_size' class='fnname'>usable_size</a>(&self, layout: &<a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>) -> <a class="primitive" href="../primitive.tuple.html">(</a><a class="primitive" href="../primitive.usize.html">usize</a>, <a class="primitive" href="../primitive.usize.html">usize</a><a class="primitive" href="../primitive.tuple.html">)</a></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Returns bounds on the guaranteed usable size of a successful allocation created with the specified <code>layout</code>. <a href="../../std/heap/trait.Alloc.html#method.usable_size">Read more</a></p> </div><h4 id='method.alloc_excess' class="method"><span id='alloc_excess.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.alloc_excess' class='fnname'>alloc_excess</a>(&mut self, layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/heap/struct.Excess.html" title="struct std::heap::Excess">Excess</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Behaves like <code>alloc</code>, but also returns the whole size of the returned block. For some <code>layout</code> inputs, like arrays, this may include extra storage usable for additional data. <a href="../../std/heap/trait.Alloc.html#method.alloc_excess">Read more</a></p> </div><h4 id='method.realloc_excess' class="method"><span id='realloc_excess.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.realloc_excess' class='fnname'>realloc_excess</a>(<br> &mut self, <br> ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <br> layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>, <br> new_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/heap/struct.Excess.html" title="struct std::heap::Excess">Excess</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Behaves like <code>realloc</code>, but also returns the whole size of the returned block. For some <code>layout</code> inputs, like arrays, this may include extra storage usable for additional data. <a href="../../std/heap/trait.Alloc.html#method.realloc_excess">Read more</a></p> </div><h4 id='method.grow_in_place' class="method"><span id='grow_in_place.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.grow_in_place' class='fnname'>grow_in_place</a>(<br> &mut self, <br> ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <br> layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>, <br> new_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>, <a class="struct" href="../../std/heap/struct.CannotReallocInPlace.html" title="struct std::heap::CannotReallocInPlace">CannotReallocInPlace</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Attempts to extend the allocation referenced by <code>ptr</code> to fit <code>new_layout</code>. <a href="../../std/heap/trait.Alloc.html#method.grow_in_place">Read more</a></p> </div><h4 id='method.shrink_in_place' class="method"><span id='shrink_in_place.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.shrink_in_place' class='fnname'>shrink_in_place</a>(<br> &mut self, <br> ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <br> layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>, <br> new_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>, <a class="struct" href="../../std/heap/struct.CannotReallocInPlace.html" title="struct std::heap::CannotReallocInPlace">CannotReallocInPlace</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Attempts to shrink the allocation referenced by <code>ptr</code> to fit <code>new_layout</code>. <a href="../../std/heap/trait.Alloc.html#method.shrink_in_place">Read more</a></p> </div><h4 id='method.alloc_one' class="method"><span id='alloc_one.v' class='invisible'><code>fn <a href='../../std/heap/trait.Alloc.html#method.alloc_one' class='fnname'>alloc_one</a><T>(&mut self) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#898-907' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Allocates a block suitable for holding an instance of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.alloc_one">Read more</a></p> </div><h4 id='method.dealloc_one' class="method"><span id='dealloc_one.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.dealloc_one' class='fnname'>dealloc_one</a><T>(&mut self, ptr: <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#926-934' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Deallocates a block suitable for holding an instance of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.dealloc_one">Read more</a></p> </div><h4 id='method.alloc_array' class="method"><span id='alloc_array.v' class='invisible'><code>fn <a href='../../std/heap/trait.Alloc.html#method.alloc_array' class='fnname'>alloc_array</a><T>(&mut self, n: <a class="primitive" href="../primitive.usize.html">usize</a>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#966-980' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Allocates a block suitable for holding <code>n</code> instances of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.alloc_array">Read more</a></p> </div><h4 id='method.realloc_array' class="method"><span id='realloc_array.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.realloc_array' class='fnname'>realloc_array</a><T>(<br> &mut self, <br> ptr: <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <br> n_old: <a class="primitive" href="../primitive.usize.html">usize</a>, <br> n_new: <a class="primitive" href="../primitive.usize.html">usize</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#1014-1029' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Reallocates a block previously suitable for holding <code>n_old</code> instances of <code>T</code>, returning a block suitable for holding <code>n_new</code> instances of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.realloc_array">Read more</a></p> </div><h4 id='method.dealloc_array' class="method"><span id='dealloc_array.v' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.dealloc_array' class='fnname'>dealloc_array</a><T>(<br> &mut self, <br> ptr: <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <br> n: <a class="primitive" href="../primitive.usize.html">usize</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#1051-1063' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Deallocates a block suitable for holding <code>n</code> instances of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.dealloc_array">Read more</a></p> </div></div><h3 id='impl-Alloc-1' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="../../std/heap/trait.Alloc.html" title="trait std::heap::Alloc">Alloc</a> for &'a <a class="struct" href="../../std/heap/struct.System.html" title="struct std::heap::System">System</a></code><a href='#impl-Alloc-1' class='anchor'></a></span><span class='out-of-band'></span></h3> <div class='impl-items'><h4 id='method.alloc-1' class="method"><span id='alloc.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#tymethod.alloc' class='fnname'>alloc</a>(&mut self, layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Returns a pointer meeting the size and alignment guarantees of <code>layout</code>. <a href="../../std/heap/trait.Alloc.html#tymethod.alloc">Read more</a></p> </div><h4 id='method.alloc_zeroed-1' class="method"><span id='alloc_zeroed.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.alloc_zeroed' class='fnname'>alloc_zeroed</a>(&mut self, layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Behaves like <code>alloc</code>, but also ensures that the contents are set to zero before being returned. <a href="../../std/heap/trait.Alloc.html#method.alloc_zeroed">Read more</a></p> </div><h4 id='method.dealloc-1' class="method"><span id='dealloc.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#tymethod.dealloc' class='fnname'>dealloc</a>(&mut self, ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, _layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>)</code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Deallocate the memory referenced by <code>ptr</code>. <a href="../../std/heap/trait.Alloc.html#tymethod.dealloc">Read more</a></p> </div><h4 id='method.realloc-1' class="method"><span id='realloc.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.realloc' class='fnname'>realloc</a>(<br> &mut self, <br> ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <br> old_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>, <br> new_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Returns a pointer suitable for holding data described by <code>new_layout</code>, meeting its size and alignment guarantees. To accomplish this, this may extend or shrink the allocation referenced by <code>ptr</code> to fit <code>new_layout</code>. <a href="../../std/heap/trait.Alloc.html#method.realloc">Read more</a></p> </div><h4 id='method.oom-1' class="method"><span id='oom.v-1' class='invisible'><code>fn <a href='../../std/heap/trait.Alloc.html#method.oom' class='fnname'>oom</a>(&mut self, err: <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>) -> <a class="primitive" href="../primitive.never.html">!</a></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Allocator-specific method for signaling an out-of-memory condition. <a href="../../std/heap/trait.Alloc.html#method.oom">Read more</a></p> </div><h4 id='method.usable_size-1' class="method"><span id='usable_size.v-1' class='invisible'><code>fn <a href='../../std/heap/trait.Alloc.html#method.usable_size' class='fnname'>usable_size</a>(&self, layout: &<a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>) -> <a class="primitive" href="../primitive.tuple.html">(</a><a class="primitive" href="../primitive.usize.html">usize</a>, <a class="primitive" href="../primitive.usize.html">usize</a><a class="primitive" href="../primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#586-588' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Returns bounds on the guaranteed usable size of a successful allocation created with the specified <code>layout</code>. <a href="../../std/heap/trait.Alloc.html#method.usable_size">Read more</a></p> </div><h4 id='method.alloc_excess-1' class="method"><span id='alloc_excess.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.alloc_excess' class='fnname'>alloc_excess</a>(&mut self, layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/heap/struct.Excess.html" title="struct std::heap::Excess">Excess</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#725-728' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Behaves like <code>alloc</code>, but also returns the whole size of the returned block. For some <code>layout</code> inputs, like arrays, this may include extra storage usable for additional data. <a href="../../std/heap/trait.Alloc.html#method.alloc_excess">Read more</a></p> </div><h4 id='method.realloc_excess-1' class="method"><span id='realloc_excess.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.realloc_excess' class='fnname'>realloc_excess</a>(<br> &mut self, <br> ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <br> layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>, <br> new_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/heap/struct.Excess.html" title="struct std::heap::Excess">Excess</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#747-754' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Behaves like <code>realloc</code>, but also returns the whole size of the returned block. For some <code>layout</code> inputs, like arrays, this may include extra storage usable for additional data. <a href="../../std/heap/trait.Alloc.html#method.realloc_excess">Read more</a></p> </div><h4 id='method.grow_in_place-1' class="method"><span id='grow_in_place.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.grow_in_place' class='fnname'>grow_in_place</a>(<br> &mut self, <br> ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <br> layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>, <br> new_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>, <a class="struct" href="../../std/heap/struct.CannotReallocInPlace.html" title="struct std::heap::CannotReallocInPlace">CannotReallocInPlace</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#792-807' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Attempts to extend the allocation referenced by <code>ptr</code> to fit <code>new_layout</code>. <a href="../../std/heap/trait.Alloc.html#method.grow_in_place">Read more</a></p> </div><h4 id='method.shrink_in_place-1' class="method"><span id='shrink_in_place.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.shrink_in_place' class='fnname'>shrink_in_place</a>(<br> &mut self, <br> ptr: <a class="primitive" href="../primitive.pointer.html">*mut </a><a class="primitive" href="../primitive.u8.html">u8</a>, <br> layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a>, <br> new_layout: <a class="struct" href="../../std/heap/struct.Layout.html" title="struct std::heap::Layout">Layout</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>, <a class="struct" href="../../std/heap/struct.CannotReallocInPlace.html" title="struct std::heap::CannotReallocInPlace">CannotReallocInPlace</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#850-865' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Attempts to shrink the allocation referenced by <code>ptr</code> to fit <code>new_layout</code>. <a href="../../std/heap/trait.Alloc.html#method.shrink_in_place">Read more</a></p> </div><h4 id='method.alloc_one-1' class="method"><span id='alloc_one.v-1' class='invisible'><code>fn <a href='../../std/heap/trait.Alloc.html#method.alloc_one' class='fnname'>alloc_one</a><T>(&mut self) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#898-907' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Allocates a block suitable for holding an instance of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.alloc_one">Read more</a></p> </div><h4 id='method.dealloc_one-1' class="method"><span id='dealloc_one.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.dealloc_one' class='fnname'>dealloc_one</a><T>(&mut self, ptr: <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#926-934' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Deallocates a block suitable for holding an instance of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.dealloc_one">Read more</a></p> </div><h4 id='method.alloc_array-1' class="method"><span id='alloc_array.v-1' class='invisible'><code>fn <a href='../../std/heap/trait.Alloc.html#method.alloc_array' class='fnname'>alloc_array</a><T>(&mut self, n: <a class="primitive" href="../primitive.usize.html">usize</a>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#966-980' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Allocates a block suitable for holding <code>n</code> instances of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.alloc_array">Read more</a></p> </div><h4 id='method.realloc_array-1' class="method"><span id='realloc_array.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.realloc_array' class='fnname'>realloc_array</a><T>(<br> &mut self, <br> ptr: <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <br> n_old: <a class="primitive" href="../primitive.usize.html">usize</a>, <br> n_new: <a class="primitive" href="../primitive.usize.html">usize</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#1014-1029' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Reallocates a block previously suitable for holding <code>n_old</code> instances of <code>T</code>, returning a block suitable for holding <code>n_new</code> instances of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.realloc_array">Read more</a></p> </div><h4 id='method.dealloc_array-1' class="method"><span id='dealloc_array.v-1' class='invisible'><code>unsafe fn <a href='../../std/heap/trait.Alloc.html#method.dealloc_array' class='fnname'>dealloc_array</a><T>(<br> &mut self, <br> ptr: <a class="struct" href="../../std/ptr/struct.NonNull.html" title="struct std::ptr::NonNull">NonNull</a><T>, <br> n: <a class="primitive" href="../primitive.usize.html">usize</a><br>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="primitive" href="../primitive.unit.html">()</a>, <a class="enum" href="../../std/heap/enum.AllocErr.html" title="enum std::heap::AllocErr">AllocErr</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#1051-1063' title='goto source code'>[src]</a></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>allocator_api </code><a href="https://github.com/rust-lang/rust/issues/32838">#32838</a>)</summary><p>the precise API and guarantees it provides may be tweaked slightly, especially to possibly take into account the types being stored to make room for a future tracing garbage collector</p> </details></div></div><div class='docblock'><p>Deallocates a block suitable for holding <code>n</code> instances of <code>T</code>. <a href="../../std/heap/trait.Alloc.html#method.dealloc_array">Read more</a></p> </div></div></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><kbd>?</kbd></dt> <dd>Show this help dialog</dd> <dt><kbd>S</kbd></dt> <dd>Focus the search field</dd> <dt><kbd>↑</kbd></dt> <dd>Move up in search results</dd> <dt><kbd>↓</kbd></dt> <dd>Move down in search results</dd> <dt><kbd>↹</kbd></dt> <dd>Switch tab</dd> <dt><kbd>⏎</kbd></dt> <dd>Go to active search result</dd> <dt><kbd>+</kbd></dt> <dd>Expand all sections</dd> <dt><kbd>-</kbd></dt> <dd>Collapse 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 = "std"; </script> <script src="../../main.js"></script> <script defer src="../../search-index.js"></script> </body> </html>