You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 16, 2024. It is now read-only.
<noscript><linkrel="stylesheet" href="../../noscript.css"></noscript><linkrel="icon" type="image/svg+xml" href="../../logo.svg"></head><bodyclass="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="sidebar"><divclass="sidebar-menu" role="button">☰</div><aclass="sidebar-logo" href="../../alloc/index.html"><divclass="logo-container"><imgclass="rust-logo" src="../../logo.svg" alt="logo"></div>
3
-
</a><divclass="sidebar-elems"><h2class="location">Other items in<br><ahref="../index.html">alloc</a>::<wbr><ahref="index.html">alloc</a></h2><divid="sidebar-vars" data-name="alloc" data-ty="fn" data-relpath=""></div><scriptdefersrc="sidebar-items.js"></script></div></nav><main><divclass="width-limiter"><divclass="sub-container"><aclass="sub-logo-container" href="../../alloc/index.html"><imgclass="rust-logo" src="../../logo.svg" alt="logo"></a><navclass="sub"><divclass="theme-picker"><buttonid="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><imgwidth="18" height="18" alt="Pick another theme!" src="../../brush.svg"></button><divid="theme-choices" role="menu"></div></div><formclass="search-form"><divclass="search-container"><div><selectid="crate-search"><optionvalue="All crates">All crates</option></select><inputclass="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><buttontype="button" id="help-button" title="help">?</button><aid="settings-menu" href="../../settings.html" title="settings"><imgwidth="18" height="18" alt="Change settings" src="../../wheel.svg"></a></div></form></nav></div><sectionid="main-content" class="content"><h1class="fqn"><spanclass="in-band">Function <ahref="../index.html">alloc</a>::<wbr><ahref="index.html">alloc</a>::<wbr><aclass="fn" href="#">alloc</a><buttonid="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><imgsrc="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span><spanclass="out-of-band"><spanclass="since" title="Stable since Rust version 1.28.0">1.28.0</span><spanid="render-detail"><aid="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<spanclass="inner">−</span>]</a></span><aclass="srclink" href="../../src/alloc/alloc.rs.html#88-90" title="goto source code">[src]</a></span></h1><divclass="docblock item-decl"><preclass="rust fn"><code>pub unsafe fn alloc(layout: <aclass="struct" href="struct.Layout.html" title="struct alloc::alloc::Layout">Layout</a>) -> <aclass="primitive" href="../../core/primitive.pointer.html">*mut </a><aclass="primitive" href="../../core/primitive.u8.html">u8</a></code></pre></div><detailsclass="rustdoc-toggle top-doc" open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>Allocate memory with the global allocator.</p>
2
+
<noscript><linkrel="stylesheet" href="../../noscript.css"></noscript><linkrel="icon" type="image/svg+xml" href="../../logo.svg"></head><bodyclass="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle">☰</button><aclass="sidebar-logo" href="../../alloc/index.html"><divclass="logo-container"><imgclass="rust-logo" src="../../rust-logo.svg" alt="logo"></div>
</a><divclass="sidebar-elems"><h2class="location"><ahref="index.html">In alloc::alloc</a></h2><divid="sidebar-vars" data-name="alloc" data-ty="fn" data-relpath=""></div><scriptdefersrc="sidebar-items.js"></script></div></nav><main><divclass="width-limiter"><divclass="sub-container"><aclass="sub-logo-container" href="../../alloc/index.html"><imgclass="rust-logo" src="../../rust-logo.svg" alt="logo"></a><navclass="sub"><divclass="theme-picker hidden"><buttonid="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><imgwidth="22" height="22" alt="Pick another theme!" src="../../brush.svg"></button><divid="theme-choices" role="menu"></div></div><formclass="search-form"><divclass="search-container"><span></span><inputclass="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><buttontype="button" id="help-button" title="help">?</button><aid="settings-menu" href="../../settings.html" title="settings"><imgwidth="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></form></nav></div><sectionid="main-content" class="content"><divclass="main-heading">
7
+
<h1class="fqn"><spanclass="in-band">Function <ahref="../index.html">alloc</a>::<wbr><ahref="index.html">alloc</a>::<wbr><aclass="fn" href="#">alloc</a><buttonid="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><imgsrc="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><spanclass="out-of-band"><spanclass="since" title="Stable since Rust version 1.28.0">1.28.0</span> · <aclass="srclink" href="../../src/alloc/alloc.rs.html#88-90">source</a> · <aid="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<spanclass="inner">−</span>]</a></span></div><divclass="docblock item-decl"><preclass="rust fn"><code>pub unsafe fn alloc(layout: <aclass="struct" href="struct.Layout.html" title="struct alloc::alloc::Layout">Layout</a>) -> <aclass="primitive" href="../../core/primitive.pointer.html">*mut </a><aclass="primitive" href="../../core/primitive.u8.html">u8</a></code></pre></div><detailsclass="rustdoc-toggle top-doc" open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>Allocate memory with the global allocator.</p>
4
8
<p>This function forwards calls to the <ahref="trait.GlobalAlloc.html#tymethod.alloc" title="GlobalAlloc::alloc"><code>GlobalAlloc::alloc</code></a> method
5
9
of the allocator registered with the <code>#[global_allocator]</code> attribute
6
10
if there is one, or the <code>std</code> crate’s default.</p>
7
11
<p>This function is expected to be deprecated in favor of the <code>alloc</code> method
8
12
of the <ahref="struct.Global.html" title="Global"><code>Global</code></a> type when it and the <ahref="trait.Allocator.html" title="Allocator"><code>Allocator</code></a> trait become stable.</p>
0 commit comments