<!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 `Layout` struct in crate `alloc`."> <meta name="keywords" content="rust, rustlang, rust-lang, Layout"> <title>alloc::allocator::Layout - 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='../../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'>Struct Layout</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.from_size_align">from_size_align</a><a href="#method.from_size_align_unchecked">from_size_align_unchecked</a><a href="#method.size">size</a><a href="#method.align">align</a><a href="#method.new">new</a><a href="#method.for_value">for_value</a><a href="#method.align_to">align_to</a><a href="#method.padding_needed_for">padding_needed_for</a><a href="#method.repeat">repeat</a><a href="#method.extend">extend</a><a href="#method.repeat_packed">repeat_packed</a><a href="#method.extend_packed">extend_packed</a><a href="#method.array">array</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-PartialEq">PartialEq</a><a href="#impl-Eq">Eq</a></div></div><p class='location'><a href='../index.html'>alloc</a>::<wbr><a href='index.html'>allocator</a></p><script>window.sidebarCurrent = {name: 'Layout', 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'>alloc</a>::<wbr><a href='index.html'>allocator</a>::<wbr><a class="struct" href=''>Layout</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><a class='srclink' href='../../src/alloc/allocator.rs.html#47-59' title='goto source code'>[src]</a></span></h1> <pre class='rust struct'>pub struct Layout { /* fields omitted */ }</pre><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>Layout of a block of memory.</p> <p>An instance of <code>Layout</code> describes a particular layout of memory. You build a <code>Layout</code> up as an input to give to an allocator.</p> <p>All layouts have an associated non-negative size and a power-of-two alignment.</p> <p>(Note however that layouts are <em>not</em> required to have positive size, even though many allocators require that all memory requests have positive size. A caller to the <code>Alloc::alloc</code> method must either ensure that conditions like this are met, or use specific allocators with looser requirements.)</p> </div> <h2 id='methods' class='small-section-header'> Methods<a href='#methods' class='anchor'></a> </h2> <h3 id='impl' class='impl'><span class='in-band'><code>impl <a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a></code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#66-303' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.from_size_align' class="method"><span id='from_size_align.v' class='invisible'><code>pub fn <a href='#method.from_size_align' class='fnname'>from_size_align</a>(size: usize, align: usize) -> <a class="enum" href="../../core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#79-109' 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>Constructs a <code>Layout</code> from a given <code>size</code> and <code>align</code>, or returns <code>None</code> if any of the following conditions are not met:</p> <ul> <li> <p><code>align</code> must be a power of two,</p> </li> <li> <p><code>align</code> must not exceed 2<sup>31</sup> (i.e. <code>1 << 31</code>),</p> </li> <li> <p><code>size</code>, when rounded up to the nearest multiple of <code>align</code>, must not overflow (i.e. the rounded value must be less than <code>usize::MAX</code>).</p> </li> </ul> </div><h4 id='method.from_size_align_unchecked' class="method"><span id='from_size_align_unchecked.v' class='invisible'><code>pub unsafe fn <a href='#method.from_size_align_unchecked' class='fnname'>from_size_align_unchecked</a>(size: usize, align: usize) -> <a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#120-122' 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>Creates a layout, bypassing all checks.</p> <h1 id="safety" class="section-header"><a href="#safety">Safety</a></h1> <p>This function is unsafe as it does not verify that <code>align</code> is a power-of-two that is also less than or equal to 2<sup>31</sup>, nor that <code>size</code> aligned to <code>align</code> fits within the address space (i.e. the <code>Layout::from_size_align</code> preconditions).</p> </div><h4 id='method.size' class="method"><span id='size.v' class='invisible'><code>pub fn <a href='#method.size' class='fnname'>size</a>(&self) -> usize</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#126' 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>The minimum size in bytes for a memory block of this layout.</p> </div><h4 id='method.align' class="method"><span id='align.v' class='invisible'><code>pub fn <a href='#method.align' class='fnname'>align</a>(&self) -> usize</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#130' 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>The minimum byte alignment for a memory block of this layout.</p> </div><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a><T>() -> Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#133-136' 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>Constructs a <code>Layout</code> suitable for holding a value of type <code>T</code>.</p> </div><h4 id='method.for_value' class="method"><span id='for_value.v' class='invisible'><code>pub fn <a href='#method.for_value' class='fnname'>for_value</a><T: ?<a class="trait" href="../../core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>>(t: &T) -> Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#141-144' 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>Produces layout describing a record that could be used to allocate backing structure for <code>T</code> (which could be a trait or other unsized type like a slice).</p> </div><h4 id='method.align_to' class="method"><span id='align_to.v' class='invisible'><code>pub fn <a href='#method.align_to' class='fnname'>align_to</a>(&self, align: usize) -> Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#163-165' 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>Creates a layout describing the record that can hold a value of the same layout as <code>self</code>, but that also is aligned to alignment <code>align</code> (measured in bytes).</p> <p>If <code>self</code> already meets the prescribed alignment, then returns <code>self</code>.</p> <p>Note that this method does not add any padding to the overall size, regardless of whether the returned layout has a different alignment. In other words, if <code>K</code> has size 16, <code>K.align_to(32)</code> will <em>still</em> have size 16.</p> <h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1> <p>Panics if the combination of <code>self.size</code> and the given <code>align</code> violates the conditions listed in <code>from_size_align</code>.</p> </div><h4 id='method.padding_needed_for' class="method"><span id='padding_needed_for.v' class='invisible'><code>pub fn <a href='#method.padding_needed_for' class='fnname'>padding_needed_for</a>(&self, align: usize) -> usize</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#184-208' 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 the amount of padding we must insert after <code>self</code> to ensure that the following address will satisfy <code>align</code> (measured in bytes).</p> <p>E.g. if <code>self.size</code> is 9, then <code>self.padding_needed_for(4)</code> returns 3, because that is the minimum number of bytes of padding required to get a 4-aligned address (assuming that the corresponding memory block starts at a 4-aligned address).</p> <p>The return value of this function has no meaning if <code>align</code> is not a power-of-two.</p> <p>Note that the utility of the returned value requires <code>align</code> to be less than or equal to the alignment of the starting address for the whole allocated block of memory. One way to satisfy this constraint is to ensure <code>align <= self.align</code>.</p> </div><h4 id='method.repeat' class="method"><span id='repeat.v' class='invisible'><code>pub fn <a href='#method.repeat' class='fnname'>repeat</a>(&self, n: usize) -> <a class="enum" href="../../core/option/enum.Option.html" title="enum core::option::Option">Option</a><(Self, usize)></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#219-228' 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>Creates a layout describing the record for <code>n</code> instances of <code>self</code>, with a suitable amount of padding between each to ensure that each instance is given its requested size and alignment. On success, returns <code>(k, offs)</code> where <code>k</code> is the layout of the array and <code>offs</code> is the distance between the start of each element in the array.</p> <p>On arithmetic overflow, returns <code>None</code>.</p> </div><h4 id='method.extend' class="method"><span id='extend.v' class='invisible'><code>pub fn <a href='#method.extend' class='fnname'>extend</a>(&self, next: Self) -> <a class="enum" href="../../core/option/enum.Option.html" title="enum core::option::Option">Option</a><(Self, usize)></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#241-252' 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>Creates a layout describing the record for <code>self</code> followed by <code>next</code>, including any necessary padding to ensure that <code>next</code> will be properly aligned. Note that the result layout will satisfy the alignment properties of both <code>self</code> and <code>next</code>.</p> <p>Returns <code>Some((k, offset))</code>, where <code>k</code> is layout of the concatenated record and <code>offset</code> is the relative location, in bytes, of the start of the <code>next</code> embedded within the concatenated record (assuming that the record itself starts at offset 0).</p> <p>On arithmetic overflow, returns <code>None</code>.</p> </div><h4 id='method.repeat_packed' class="method"><span id='repeat_packed.v' class='invisible'><code>pub fn <a href='#method.repeat_packed' class='fnname'>repeat_packed</a>(&self, n: usize) -> <a class="enum" href="../../core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#266-269' 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>Creates a layout describing the record for <code>n</code> instances of <code>self</code>, with no padding between each instance.</p> <p>Note that, unlike <code>repeat</code>, <code>repeat_packed</code> does not guarantee that the repeated instances of <code>self</code> will be properly aligned, even if a given instance of <code>self</code> is properly aligned. In other words, if the layout returned by <code>repeat_packed</code> is used to allocate an array, it is not guaranteed that all elements in the array will be properly aligned.</p> <p>On arithmetic overflow, returns <code>None</code>.</p> </div><h4 id='method.extend_packed' class="method"><span id='extend_packed.v' class='invisible'><code>pub fn <a href='#method.extend_packed' class='fnname'>extend_packed</a>(&self, next: Self) -> <a class="enum" href="../../core/option/enum.Option.html" title="enum core::option::Option">Option</a><(Self, usize)></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#286-290' 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>Creates a layout describing the record for <code>self</code> followed by <code>next</code> with no additional padding between the two. Since no padding is inserted, the alignment of <code>next</code> is irrelevant, and is not incorporated <em>at all</em> into the resulting layout.</p> <p>Returns <code>(k, offset)</code>, where <code>k</code> is layout of the concatenated record and <code>offset</code> is the relative location, in bytes, of the start of the <code>next</code> embedded within the concatenated record (assuming that the record itself starts at offset 0).</p> <p>(The <code>offset</code> is always the same as <code>self.size()</code>; we use this signature out of convenience in matching the signature of <code>extend</code>.)</p> <p>On arithmetic overflow, returns <code>None</code>.</p> </div><h4 id='method.array' class="method"><span id='array.v' class='invisible'><code>pub fn <a href='#method.array' class='fnname'>array</a><T>(n: usize) -> <a class="enum" href="../../core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#295-302' 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>Creates a layout describing the record for a <code>[T; n]</code>.</p> <p>On arithmetic overflow, returns <code>None</code>.</p> </div></div> <h2 id='implementations' class='small-section-header'> Trait Implementations<a href='#implementations' class='anchor'></a> </h2> <h3 id='impl-Clone' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a></code><a href='#impl-Clone' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#46' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='../../core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#46' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Returns a copy of the value. <a href="../../core/clone/trait.Clone.html#tymethod.clone">Read more</a></p> </div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='../../core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &Self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='../../src/core/clone.rs.html#112-114' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="../../core/clone/trait.Clone.html#method.clone_from">Read more</a></p> </div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../alloc/fmt/trait.Debug.html" title="trait alloc::fmt::Debug">Debug</a> for <a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#46' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='../../alloc/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, __arg_0: &mut <a class="struct" href="../../alloc/fmt/struct.Formatter.html" title="struct alloc::fmt::Formatter">Formatter</a>) -> <a class="type" href="../../alloc/fmt/type.Result.html" title="type alloc::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#46' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>Formats the value using the given formatter. <a href="../../alloc/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p> </div></div><h3 id='impl-PartialEq' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a></code><a href='#impl-PartialEq' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#46' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.eq' class="method"><span id='eq.v' class='invisible'><code>fn <a href='../../core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, __arg_0: &<a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a>) -> bool</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#46' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p> </div><h4 id='method.ne' class="method"><span id='ne.v' class='invisible'><code>fn <a href='../../core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, __arg_0: &<a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a>) -> bool</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#46' title='goto source code'>[src]</a></span></h4> <div class='docblock'><p>This method tests for <code>!=</code>.</p> </div></div><h3 id='impl-Eq' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="../../alloc/allocator/struct.Layout.html" title="struct alloc::allocator::Layout">Layout</a></code><a href='#impl-Eq' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/alloc/allocator.rs.html#46' title='goto source code'>[src]</a></span></h3> <div class='impl-items'></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 = "alloc"; </script> <script src="../../main.js"></script> <script defer src="../../search-index.js"></script> </body> </html>