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.
<linkrel="alternate icon" type="image/png" href="../../favicon-32x32.png"><styletype="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></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><ahref='../../alloc/index.html'><divclass='logo-container rust-logo'><imgsrc='../../rust-logo.png' alt='logo'></div></a><divclass="sidebar-elems"><pclass="location">Other items in<br><ahref="../index.html">alloc</a>::<wbr><ahref="index.html">alloc</a></p><divid="sidebar-vars" data-name="alloc" data-ty="fn" data-relpath=""></div><scriptdefersrc="sidebar-items.js"></script></div></nav><divclass="theme-picker"><buttonid="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><imgsrc="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><divid="theme-choices" role="menu"></div></div><navclass="sub"><formclass="search-form"><divclass="search-container"><div><selectid="crate-search"><optionvalue="All crates">All crates</option></select><inputclass="search-input" name="search" disabledautocomplete="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"><imgsrc="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><sectionid="main" 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 path"><imgsrc="../../clipboard.svg" width="19" height="18" alt="Copy item import" title="Copy item import to clipboard"></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#87-89" title="goto source code">[src]</a></span></h1><preclass="rust fn">pub unsafe fn alloc(layout: <aclass="struct" href="struct.Layout.html" title="struct alloc::alloc::Layout">Layout</a>) -> *mut u8</pre><detailsclass="rustdoc-toggle top-doc" open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>Allocate memory with the global allocator.</p>
1
+
<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport" content="width=device-width, initial-scale=1.0"><metaname="generator" content="rustdoc"><metaname="description" content="Allocate memory with the global allocator."><metaname="keywords" content="rust, rustlang, rust-lang, alloc"><title>alloc in alloc::alloc - Rust</title><linkrel="stylesheet" type="text/css" href="../../normalize.css"><linkrel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><linkrel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><linkrel="stylesheet" type="text/css" href="../../dark.css" disabled><linkrel="stylesheet" type="text/css" href="../../ayu.css" disabled><scriptid="default-settings" ></script><scriptsrc="../../storage.js"></script><scriptsrc="../../crates.js"></script><noscript><linkrel="stylesheet" href="../../noscript.css"></noscript><linkrel="alternate icon" type="image/png" href="../../favicon-16x16.png"><linkrel="alternate icon" type="image/png" href="../../favicon-32x32.png"><linkrel="icon" type="image/svg+xml" href="../../favicon.svg"><styletype="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></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><ahref='../../alloc/index.html'><divclass='logo-container rust-logo'><imgsrc='../../rust-logo.png' alt='logo'></div></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><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><navclass="sub"><formclass="search-form"><divclass="search-container"><div><selectid="crate-search"><optionvalue="All crates">All crates</option></select><inputclass="search-input" name="search" disabledautocomplete="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><sectionid="main" 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#87-89" title="goto source code">[src]</a></span></h1><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><detailsclass="rustdoc-toggle top-doc" open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>Allocate memory with the global allocator.</p>
4
2
<p>This function forwards calls to the <ahref="trait.GlobalAlloc.html#tymethod.alloc" title="GlobalAlloc::alloc"><code>GlobalAlloc::alloc</code></a> method
5
3
of the allocator registered with the <code>#[global_allocator]</code> attribute
6
4
if there is one, or the <code>std</code> crate’s default.</p>
7
5
<p>This function is expected to be deprecated in favor of the <code>alloc</code> method
8
6
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