deploy: 95756b1a57
This commit is contained in:
commit
0fa87f2b35
16382 changed files with 734838 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
<!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="Allocates memory with the global allocator."><title>alloc in cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">alloc</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#safety" title="Safety">Safety</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Function <span class="fn">alloc</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/alloc.rs.html#88">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe fn alloc(layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Allocates memory with the global allocator.</p>
|
||||
<p>This function forwards calls to the <a href="trait.GlobalAlloc.html#tymethod.alloc" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc::alloc"><code>GlobalAlloc::alloc</code></a> method
|
||||
of the allocator registered with the <code>#[global_allocator]</code> attribute
|
||||
if there is one, or the <code>std</code> crate’s default.</p>
|
||||
<p>This function is expected to be deprecated in favor of the <code>allocate</code> method
|
||||
of the <a href="struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global"><code>Global</code></a> type when it and the <a href="trait.Allocator.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator"><code>Allocator</code></a> trait become stable.</p>
|
||||
<h2 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h2>
|
||||
<p>See <a href="trait.GlobalAlloc.html#tymethod.alloc" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc::alloc"><code>GlobalAlloc::alloc</code></a>.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::alloc::{alloc, dealloc, handle_alloc_error, Layout};
|
||||
|
||||
<span class="kw">unsafe </span>{
|
||||
<span class="kw">let </span>layout = Layout::new::<u16>();
|
||||
<span class="kw">let </span>ptr = alloc(layout);
|
||||
<span class="kw">if </span>ptr.is_null() {
|
||||
handle_alloc_error(layout);
|
||||
}
|
||||
|
||||
<span class="kw-2">*</span>(ptr <span class="kw">as </span><span class="kw-2">*mut </span>u16) = <span class="number">42</span>;
|
||||
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>(ptr <span class="kw">as </span><span class="kw-2">*mut </span>u16), <span class="number">42</span>);
|
||||
|
||||
dealloc(ptr, layout);
|
||||
}</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!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="Allocates zero-initialized memory with the global allocator."><title>alloc_zeroed in cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">alloc_<wbr>zeroed</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#safety" title="Safety">Safety</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Function <span class="fn">alloc_zeroed</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/alloc.rs.html#171">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe fn alloc_zeroed(layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Allocates zero-initialized memory with the global allocator.</p>
|
||||
<p>This function forwards calls to the <a href="trait.GlobalAlloc.html#method.alloc_zeroed" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc::alloc_zeroed"><code>GlobalAlloc::alloc_zeroed</code></a> method
|
||||
of the allocator registered with the <code>#[global_allocator]</code> attribute
|
||||
if there is one, or the <code>std</code> crate’s default.</p>
|
||||
<p>This function is expected to be deprecated in favor of the <code>allocate_zeroed</code> method
|
||||
of the <a href="struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global"><code>Global</code></a> type when it and the <a href="trait.Allocator.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator"><code>Allocator</code></a> trait become stable.</p>
|
||||
<h2 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h2>
|
||||
<p>See <a href="trait.GlobalAlloc.html#method.alloc_zeroed" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc::alloc_zeroed"><code>GlobalAlloc::alloc_zeroed</code></a>.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::alloc::{alloc_zeroed, dealloc, handle_alloc_error, Layout};
|
||||
|
||||
<span class="kw">unsafe </span>{
|
||||
<span class="kw">let </span>layout = Layout::new::<u16>();
|
||||
<span class="kw">let </span>ptr = alloc_zeroed(layout);
|
||||
<span class="kw">if </span>ptr.is_null() {
|
||||
handle_alloc_error(layout);
|
||||
}
|
||||
|
||||
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>(ptr <span class="kw">as </span><span class="kw-2">*mut </span>u16), <span class="number">0</span>);
|
||||
|
||||
dealloc(ptr, layout);
|
||||
}</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<!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="Deallocates memory with the global allocator."><title>dealloc in cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">dealloc</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#safety" title="Safety">Safety</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Function <span class="fn">dealloc</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/alloc.rs.html#113">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe fn dealloc(ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>)</code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Deallocates memory with the global allocator.</p>
|
||||
<p>This function forwards calls to the <a href="trait.GlobalAlloc.html#tymethod.dealloc" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc::dealloc"><code>GlobalAlloc::dealloc</code></a> method
|
||||
of the allocator registered with the <code>#[global_allocator]</code> attribute
|
||||
if there is one, or the <code>std</code> crate’s default.</p>
|
||||
<p>This function is expected to be deprecated in favor of the <code>deallocate</code> method
|
||||
of the <a href="struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global"><code>Global</code></a> type when it and the <a href="trait.Allocator.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator"><code>Allocator</code></a> trait become stable.</p>
|
||||
<h2 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h2>
|
||||
<p>See <a href="trait.GlobalAlloc.html#tymethod.dealloc" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc::dealloc"><code>GlobalAlloc::dealloc</code></a>.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!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="Signals a memory allocation error."><title>handle_alloc_error in cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Function <span class="fn">handle_alloc_error</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0, const unstable">1.36.0 (const: <a href="https://github.com/rust-lang/rust/issues/92523" title="Tracking issue for const_alloc_error">unstable</a>)</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/alloc.rs.html#398">Source</a> </span></div><pre class="rust item-decl"><code>pub fn handle_alloc_error(layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.never.html">!</a></code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Signals a memory allocation error.</p>
|
||||
<p>Callers of memory allocation APIs wishing to cease execution
|
||||
in response to an allocation error are encouraged to call this function,
|
||||
rather than directly invoking <a href="https://doc.rust-lang.org/nightly/core/macro.panic.html" title="macro core::panic"><code>panic!</code></a> or similar.</p>
|
||||
<p>This function is guaranteed to diverge (not return normally with a value), but depending on
|
||||
global configuration, it may either panic (resulting in unwinding or aborting as per
|
||||
configuration for all panics), or abort the process (with no unwinding).</p>
|
||||
<p>The default behavior is:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>If the binary links against <code>std</code> (typically the case), then
|
||||
print a message to standard error and abort the process.
|
||||
This behavior can be replaced with <a href="../../std/alloc/fn.set_alloc_error_hook.html"><code>set_alloc_error_hook</code></a> and <a href="../../std/alloc/fn.take_alloc_error_hook.html"><code>take_alloc_error_hook</code></a>.
|
||||
Future versions of Rust may panic by default instead.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If the binary does not link against <code>std</code> (all of its crates are marked
|
||||
<a href="https://doc.rust-lang.org/reference/names/preludes.html#the-no_std-attribute"><code>#![no_std]</code></a>), then call <a href="https://doc.rust-lang.org/nightly/core/macro.panic.html" title="macro core::panic"><code>panic!</code></a> with a message.
|
||||
<a href="https://doc.rust-lang.org/reference/runtime.html#the-panic_handler-attribute">The panic handler</a> applies as to any panic.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<!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="Reallocates memory with the global allocator."><title>realloc in cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">realloc</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#safety" title="Safety">Safety</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Function <span class="fn">realloc</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/alloc.rs.html#133">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe fn realloc(ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>, new_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Reallocates memory with the global allocator.</p>
|
||||
<p>This function forwards calls to the <a href="trait.GlobalAlloc.html#method.realloc" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc::realloc"><code>GlobalAlloc::realloc</code></a> method
|
||||
of the allocator registered with the <code>#[global_allocator]</code> attribute
|
||||
if there is one, or the <code>std</code> crate’s default.</p>
|
||||
<p>This function is expected to be deprecated in favor of the <code>grow</code> and <code>shrink</code> methods
|
||||
of the <a href="struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global"><code>Global</code></a> type when it and the <a href="trait.Allocator.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator"><code>Allocator</code></a> trait become stable.</p>
|
||||
<h2 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h2>
|
||||
<p>See <a href="trait.GlobalAlloc.html#method.realloc" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc::realloc"><code>GlobalAlloc::realloc</code></a>.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<!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="Memory allocation APIs"><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module alloc</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a></div><h1>Module <span>alloc</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/lib.rs.html#209">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Memory allocation APIs</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a></dt><dd>Layout of a block of memory.</dd><dt><a class="struct" href="struct.LayoutError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::LayoutError">Layout<wbr>Error</a></dt><dd>The <code>LayoutError</code> is returned when the parameters given
|
||||
to <code>Layout::from_size_align</code>
|
||||
or some other <code>Layout</code> constructor
|
||||
do not satisfy its documented constraints.</dd><dt><a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">Alloc<wbr>Error</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>The <code>AllocError</code> error indicates an allocation failure
|
||||
that may be due to resource exhaustion or to
|
||||
something wrong when combining the given input arguments with this
|
||||
allocator.</dd><dt><a class="struct" href="struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global">Global</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>The global memory allocator.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.GlobalAlloc.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc">Global<wbr>Alloc</a></dt><dd>A memory allocator that can be registered as the standard library’s default
|
||||
through the <code>#[global_allocator]</code> attribute.</dd><dt><a class="trait" href="trait.Allocator.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator">Allocator</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>An implementation of <code>Allocator</code> can allocate, grow, shrink, and deallocate arbitrary blocks of
|
||||
data described via <a href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout"><code>Layout</code></a>.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.alloc.html" title="fn cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::alloc">alloc</a><sup title="unsafe function">⚠</sup></dt><dd>Allocates memory with the global allocator.</dd><dt><a class="fn" href="fn.alloc_zeroed.html" title="fn cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::alloc_zeroed">alloc_<wbr>zeroed</a><sup title="unsafe function">⚠</sup></dt><dd>Allocates zero-initialized memory with the global allocator.</dd><dt><a class="fn" href="fn.dealloc.html" title="fn cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::dealloc">dealloc</a><sup title="unsafe function">⚠</sup></dt><dd>Deallocates memory with the global allocator.</dd><dt><a class="fn" href="fn.handle_alloc_error.html" title="fn cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::handle_alloc_error">handle_<wbr>alloc_<wbr>error</a></dt><dd>Signals a memory allocation error.</dd><dt><a class="fn" href="fn.realloc.html" title="fn cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::realloc">realloc</a><sup title="unsafe function">⚠</sup></dt><dd>Reallocates memory with the global allocator.</dd></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.LayoutErr.html" title="type cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::LayoutErr">Layout<wbr>Err</a><wbr><span class="stab deprecated" title="">Deprecated</span></dt></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"fn":["alloc","alloc_zeroed","dealloc","handle_alloc_error","realloc"],"struct":["AllocError","Global","Layout","LayoutError"],"trait":["Allocator","GlobalAlloc"],"type":["LayoutErr"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,203 @@
|
|||
<!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="An implementation of `Allocator` can allocate, grow, shrink, and deallocate arbitrary blocks of data described via `Layout`."><title>Allocator in cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Allocator</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#currently-allocated-memory" title="Currently allocated memory">Currently allocated memory</a></li><li><a href="#memory-fitting" title="Memory fitting">Memory fitting</a></li><li><a href="#safety" title="Safety">Safety</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.allocate" title="allocate">allocate</a></li><li><a href="#tymethod.deallocate" title="deallocate">deallocate</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.allocate_zeroed" title="allocate_zeroed">allocate_zeroed</a></li><li><a href="#method.by_ref" title="by_ref">by_ref</a></li><li><a href="#method.grow" title="grow">grow</a></li><li><a href="#method.grow_zeroed" title="grow_zeroed">grow_zeroed</a></li><li><a href="#method.shrink" title="shrink">shrink</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Trait <span class="trait">Allocator</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://doc.rust-lang.org/nightly/src/core/alloc/mod.rs.html#105">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe trait Allocator {
|
||||
// Required methods
|
||||
fn <a href="#tymethod.allocate" class="fn">allocate</a>(&self, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>>;
|
||||
<span class="item-spacer"></span> unsafe fn <a href="#tymethod.deallocate" class="fn">deallocate</a>(&self, ptr: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>);
|
||||
|
||||
// Provided methods
|
||||
fn <a href="#method.allocate_zeroed" class="fn">allocate_zeroed</a>(
|
||||
&self,
|
||||
layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>> { ... }
|
||||
<span class="item-spacer"></span> unsafe fn <a href="#method.grow" class="fn">grow</a>(
|
||||
&self,
|
||||
ptr: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>,
|
||||
old_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
new_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>> { ... }
|
||||
<span class="item-spacer"></span> unsafe fn <a href="#method.grow_zeroed" class="fn">grow_zeroed</a>(
|
||||
&self,
|
||||
ptr: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>,
|
||||
old_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
new_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>> { ... }
|
||||
<span class="item-spacer"></span> unsafe fn <a href="#method.shrink" class="fn">shrink</a>(
|
||||
&self,
|
||||
ptr: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>,
|
||||
old_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
new_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>> { ... }
|
||||
<span class="item-spacer"></span> fn <a href="#method.by_ref" class="fn">by_ref</a>(&self) -> &Self
|
||||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||||
}</code></pre><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An implementation of <code>Allocator</code> can allocate, grow, shrink, and deallocate arbitrary blocks of
|
||||
data described via <a href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout"><code>Layout</code></a>.</p>
|
||||
<p><code>Allocator</code> is designed to be implemented on ZSTs, references, or smart pointers.
|
||||
An allocator for <code>MyAlloc([u8; N])</code> cannot be moved, without updating the pointers to the
|
||||
allocated memory.</p>
|
||||
<p>In contrast to <a href="trait.GlobalAlloc.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc"><code>GlobalAlloc</code></a>, <code>Allocator</code> allows zero-sized allocations. If an underlying
|
||||
allocator does not support this (like jemalloc) or responds by returning a null pointer
|
||||
(such as <code>libc::malloc</code>), this must be caught by the implementation.</p>
|
||||
<h4 id="currently-allocated-memory"><a class="doc-anchor" href="#currently-allocated-memory">§</a>Currently allocated memory</h4>
|
||||
<p>Some of the methods require that a memory block is <em>currently allocated</em> by an allocator.
|
||||
This means that:</p>
|
||||
<ul>
|
||||
<li>the starting address for that memory block was previously
|
||||
returned by <a href="trait.Allocator.html#tymethod.allocate" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator::allocate"><code>allocate</code></a>, <a href="trait.Allocator.html#method.grow" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator::grow"><code>grow</code></a>, or <a href="trait.Allocator.html#method.shrink" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator::shrink"><code>shrink</code></a>, and</li>
|
||||
<li>the memory block has not subsequently been deallocated.</li>
|
||||
</ul>
|
||||
<p>A memory block is deallocated by a call to <a href="trait.Allocator.html#tymethod.deallocate" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator::deallocate"><code>deallocate</code></a>,
|
||||
or by a call to <a href="trait.Allocator.html#method.grow" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator::grow"><code>grow</code></a> or <a href="trait.Allocator.html#method.shrink" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator::shrink"><code>shrink</code></a> that returns <code>Ok</code>.
|
||||
A call to <code>grow</code> or <code>shrink</code> that returns <code>Err</code>,
|
||||
does not deallocate the memory block passed to it.</p>
|
||||
<h4 id="memory-fitting"><a class="doc-anchor" href="#memory-fitting">§</a>Memory fitting</h4>
|
||||
<p>Some of the methods require that a <code>layout</code> <em>fit</em> a memory block or vice versa. This means that the
|
||||
following conditions must hold:</p>
|
||||
<ul>
|
||||
<li>the memory block must be <em>currently allocated</em> with alignment of <a href="struct.Layout.html#method.align" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout::align"><code>layout.align()</code></a>, and</li>
|
||||
<li><a href="struct.Layout.html#method.size" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout::size"><code>layout.size()</code></a> must fall in the range <code>min ..= max</code>, where:
|
||||
<ul>
|
||||
<li><code>min</code> is the size of the layout used to allocate the block, and</li>
|
||||
<li><code>max</code> is the actual size returned from <a href="trait.Allocator.html#tymethod.allocate" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator::allocate"><code>allocate</code></a>, <a href="trait.Allocator.html#method.grow" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator::grow"><code>grow</code></a>, or <a href="trait.Allocator.html#method.shrink" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator::shrink"><code>shrink</code></a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h2>
|
||||
<p>Memory blocks that are <a href="#currently-allocated-memory"><em>currently allocated</em></a> by an allocator,
|
||||
must point to valid memory, and retain their validity until either:</p>
|
||||
<ul>
|
||||
<li>the memory block is deallocated, or</li>
|
||||
<li>the allocator is dropped.</li>
|
||||
</ul>
|
||||
<p>Copying, cloning, or moving the allocator must not invalidate memory blocks returned from it.
|
||||
A copied or cloned allocator must behave like the original allocator.</p>
|
||||
<p>A memory block which is <a href="#currently-allocated-memory"><em>currently allocated</em></a> may be passed to
|
||||
any method of the allocator that accepts such an argument.</p>
|
||||
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.allocate" class="method"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/alloc/mod.rs.html#132">Source</a><h4 class="code-header">fn <a href="#tymethod.allocate" class="fn">allocate</a>(&self, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Attempts to allocate a block of memory.</p>
|
||||
<p>On success, returns a <a href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull"><code>NonNull<[u8]></code></a> meeting the size and alignment guarantees of <code>layout</code>.</p>
|
||||
<p>The returned block may have a larger size than specified by <code>layout.size()</code>, and may or may
|
||||
not have its contents initialized.</p>
|
||||
<p>The returned block of memory remains valid as long as it is <a href="#currently-allocated-memory"><em>currently allocated</em></a> and the shorter of:</p>
|
||||
<ul>
|
||||
<li>the borrow-checker lifetime of the allocator type itself.</li>
|
||||
<li>as long as the allocator and all its clones have not been dropped.</li>
|
||||
</ul>
|
||||
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
||||
<p>Returning <code>Err</code> indicates that either memory is exhausted or <code>layout</code> does not meet
|
||||
allocator’s size or alignment constraints.</p>
|
||||
<p>Implementations are encouraged to return <code>Err</code> on memory exhaustion rather than panicking or
|
||||
aborting, but this is not a strict requirement. (Specifically: it is <em>legal</em> to implement
|
||||
this trait atop an underlying native allocation library that aborts on memory exhaustion.)</p>
|
||||
<p>Clients wishing to abort computation in response to an allocation error are encouraged to
|
||||
call the <a href="../../alloc/alloc/fn.handle_alloc_error.html"><code>handle_alloc_error</code></a> function, rather than directly invoking <code>panic!</code> or similar.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.deallocate" class="method"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/alloc/mod.rs.html#165">Source</a><h4 class="code-header">unsafe fn <a href="#tymethod.deallocate" class="fn">deallocate</a>(&self, ptr: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>)</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Deallocates the memory referenced by <code>ptr</code>.</p>
|
||||
<h5 id="safety-1"><a class="doc-anchor" href="#safety-1">§</a>Safety</h5>
|
||||
<ul>
|
||||
<li><code>ptr</code> must denote a block of memory <a href="#currently-allocated-memory"><em>currently allocated</em></a> via this allocator, and</li>
|
||||
<li><code>layout</code> must <a href="#memory-fitting"><em>fit</em></a> that block of memory.</li>
|
||||
</ul>
|
||||
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.allocate_zeroed" class="method"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/alloc/mod.rs.html#149">Source</a><h4 class="code-header">fn <a href="#method.allocate_zeroed" class="fn">allocate_zeroed</a>(&self, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Behaves like <code>allocate</code>, but also ensures that the returned memory is zero-initialized.</p>
|
||||
<h5 id="errors-1"><a class="doc-anchor" href="#errors-1">§</a>Errors</h5>
|
||||
<p>Returning <code>Err</code> indicates that either memory is exhausted or <code>layout</code> does not meet
|
||||
allocator’s size or alignment constraints.</p>
|
||||
<p>Implementations are encouraged to return <code>Err</code> on memory exhaustion rather than panicking or
|
||||
aborting, but this is not a strict requirement. (Specifically: it is <em>legal</em> to implement
|
||||
this trait atop an underlying native allocation library that aborts on memory exhaustion.)</p>
|
||||
<p>Clients wishing to abort computation in response to an allocation error are encouraged to
|
||||
call the <a href="../../alloc/alloc/fn.handle_alloc_error.html"><code>handle_alloc_error</code></a> function, rather than directly invoking <code>panic!</code> or similar.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.grow" class="method"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/alloc/mod.rs.html#205-210">Source</a><h4 class="code-header">unsafe fn <a href="#method.grow" class="fn">grow</a>(
|
||||
&self,
|
||||
ptr: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>,
|
||||
old_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
new_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Attempts to extend the memory block.</p>
|
||||
<p>Returns a new <a href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull"><code>NonNull<[u8]></code></a> containing a pointer and the actual size of the allocated
|
||||
memory. The pointer is suitable for holding data described by <code>new_layout</code>. To accomplish
|
||||
this, the allocator may extend the allocation referenced by <code>ptr</code> to fit the new layout.</p>
|
||||
<p>If this returns <code>Ok</code>, then ownership of the memory block referenced by <code>ptr</code> has been
|
||||
transferred to this allocator. Any access to the old <code>ptr</code> is Undefined Behavior, even if the
|
||||
allocation was grown in-place. The newly returned pointer is the only valid pointer
|
||||
for accessing this memory now.</p>
|
||||
<p>If this method returns <code>Err</code>, then ownership of the memory block has not been transferred to
|
||||
this allocator, and the contents of the memory block are unaltered.</p>
|
||||
<h5 id="safety-2"><a class="doc-anchor" href="#safety-2">§</a>Safety</h5>
|
||||
<ul>
|
||||
<li><code>ptr</code> must denote a block of memory <a href="#currently-allocated-memory"><em>currently allocated</em></a> via this allocator.</li>
|
||||
<li><code>old_layout</code> must <a href="#memory-fitting"><em>fit</em></a> that block of memory (The <code>new_layout</code> argument need not fit it.).</li>
|
||||
<li><code>new_layout.size()</code> must be greater than or equal to <code>old_layout.size()</code>.</li>
|
||||
</ul>
|
||||
<p>Note that <code>new_layout.align()</code> need not be the same as <code>old_layout.align()</code>.</p>
|
||||
<h5 id="errors-2"><a class="doc-anchor" href="#errors-2">§</a>Errors</h5>
|
||||
<p>Returns <code>Err</code> if the new layout does not meet the allocator’s size and alignment
|
||||
constraints of the allocator, or if growing otherwise fails.</p>
|
||||
<p>Implementations are encouraged to return <code>Err</code> on memory exhaustion rather than panicking or
|
||||
aborting, but this is not a strict requirement. (Specifically: it is <em>legal</em> to implement
|
||||
this trait atop an underlying native allocation library that aborts on memory exhaustion.)</p>
|
||||
<p>Clients wishing to abort computation in response to an allocation error are encouraged to
|
||||
call the <a href="../../alloc/alloc/fn.handle_alloc_error.html"><code>handle_alloc_error</code></a> function, rather than directly invoking <code>panic!</code> or similar.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.grow_zeroed" class="method"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/alloc/mod.rs.html#268-273">Source</a><h4 class="code-header">unsafe fn <a href="#method.grow_zeroed" class="fn">grow_zeroed</a>(
|
||||
&self,
|
||||
ptr: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>,
|
||||
old_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
new_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Behaves like <code>grow</code>, but also ensures that the new contents are set to zero before being
|
||||
returned.</p>
|
||||
<p>The memory block will contain the following contents after a successful call to
|
||||
<code>grow_zeroed</code>:</p>
|
||||
<ul>
|
||||
<li>Bytes <code>0..old_layout.size()</code> are preserved from the original allocation.</li>
|
||||
<li>Bytes <code>old_layout.size()..old_size</code> will either be preserved or zeroed, depending on
|
||||
the allocator implementation. <code>old_size</code> refers to the size of the memory block prior
|
||||
to the <code>grow_zeroed</code> call, which may be larger than the size that was originally
|
||||
requested when it was allocated.</li>
|
||||
<li>Bytes <code>old_size..new_size</code> are zeroed. <code>new_size</code> refers to the size of the memory
|
||||
block returned by the <code>grow_zeroed</code> call.</li>
|
||||
</ul>
|
||||
<h5 id="safety-3"><a class="doc-anchor" href="#safety-3">§</a>Safety</h5>
|
||||
<ul>
|
||||
<li><code>ptr</code> must denote a block of memory <a href="#currently-allocated-memory"><em>currently allocated</em></a> via this allocator.</li>
|
||||
<li><code>old_layout</code> must <a href="#memory-fitting"><em>fit</em></a> that block of memory (The <code>new_layout</code> argument need not fit it.).</li>
|
||||
<li><code>new_layout.size()</code> must be greater than or equal to <code>old_layout.size()</code>.</li>
|
||||
</ul>
|
||||
<p>Note that <code>new_layout.align()</code> need not be the same as <code>old_layout.align()</code>.</p>
|
||||
<h5 id="errors-3"><a class="doc-anchor" href="#errors-3">§</a>Errors</h5>
|
||||
<p>Returns <code>Err</code> if the new layout does not meet the allocator’s size and alignment
|
||||
constraints of the allocator, or if growing otherwise fails.</p>
|
||||
<p>Implementations are encouraged to return <code>Err</code> on memory exhaustion rather than panicking or
|
||||
aborting, but this is not a strict requirement. (Specifically: it is <em>legal</em> to implement
|
||||
this trait atop an underlying native allocation library that aborts on memory exhaustion.)</p>
|
||||
<p>Clients wishing to abort computation in response to an allocation error are encouraged to
|
||||
call the <a href="../../alloc/alloc/fn.handle_alloc_error.html"><code>handle_alloc_error</code></a> function, rather than directly invoking <code>panic!</code> or similar.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.shrink" class="method"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/alloc/mod.rs.html#332-337">Source</a><h4 class="code-header">unsafe fn <a href="#method.shrink" class="fn">shrink</a>(
|
||||
&self,
|
||||
ptr: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>,
|
||||
old_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
new_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull">NonNull</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>, <a class="struct" href="struct.AllocError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::AllocError">AllocError</a>></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Attempts to shrink the memory block.</p>
|
||||
<p>Returns a new <a href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html" title="struct core::ptr::non_null::NonNull"><code>NonNull<[u8]></code></a> containing a pointer and the actual size of the allocated
|
||||
memory. The pointer is suitable for holding data described by <code>new_layout</code>. To accomplish
|
||||
this, the allocator may shrink the allocation referenced by <code>ptr</code> to fit the new layout.</p>
|
||||
<p>If this returns <code>Ok</code>, then ownership of the memory block referenced by <code>ptr</code> has been
|
||||
transferred to this allocator. Any access to the old <code>ptr</code> is Undefined Behavior, even if the
|
||||
allocation was shrunk in-place. The newly returned pointer is the only valid pointer
|
||||
for accessing this memory now.</p>
|
||||
<p>If this method returns <code>Err</code>, then ownership of the memory block has not been transferred to
|
||||
this allocator, and the contents of the memory block are unaltered.</p>
|
||||
<h5 id="safety-4"><a class="doc-anchor" href="#safety-4">§</a>Safety</h5>
|
||||
<ul>
|
||||
<li><code>ptr</code> must denote a block of memory <a href="#currently-allocated-memory"><em>currently allocated</em></a> via this allocator.</li>
|
||||
<li><code>old_layout</code> must <a href="#memory-fitting"><em>fit</em></a> that block of memory (The <code>new_layout</code> argument need not fit it.).</li>
|
||||
<li><code>new_layout.size()</code> must be smaller than or equal to <code>old_layout.size()</code>.</li>
|
||||
</ul>
|
||||
<p>Note that <code>new_layout.align()</code> need not be the same as <code>old_layout.align()</code>.</p>
|
||||
<h5 id="errors-4"><a class="doc-anchor" href="#errors-4">§</a>Errors</h5>
|
||||
<p>Returns <code>Err</code> if the new layout does not meet the allocator’s size and alignment
|
||||
constraints of the allocator, or if shrinking otherwise fails.</p>
|
||||
<p>Implementations are encouraged to return <code>Err</code> on memory exhaustion rather than panicking or
|
||||
aborting, but this is not a strict requirement. (Specifically: it is <em>legal</em> to implement
|
||||
this trait atop an underlying native allocation library that aborts on memory exhaustion.)</p>
|
||||
<p>Clients wishing to abort computation in response to an allocation error are encouraged to
|
||||
call the <a href="../../alloc/alloc/fn.handle_alloc_error.html"><code>handle_alloc_error</code></a> function, rather than directly invoking <code>panic!</code> or similar.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.by_ref" class="method"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/alloc/mod.rs.html#362-364">Source</a><h4 class="code-header">fn <a href="#method.by_ref" class="fn">by_ref</a>(&self) -> &Self<div class="where">where
|
||||
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Creates a “by reference” adapter for this instance of <code>Allocator</code>.</p>
|
||||
<p>The returned adapter also implements <code>Allocator</code> and will simply borrow this.</p>
|
||||
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Allocator-for-System" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/std/alloc.rs.html#204">Source</a><a href="#impl-Allocator-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Allocator.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator">Allocator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/alloc/struct.System.html" title="struct std::alloc::System">System</a></h3></section><section id="impl-Allocator-for-Global" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/alloc/alloc.rs.html#246">Source</a><a href="#impl-Allocator-for-Global" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Allocator.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator">Allocator</a> for <a class="struct" href="struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global">Global</a></h3></section><section id="impl-Allocator-for-%26A" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/alloc/mod.rs.html#371-373">Source</a><a href="#impl-Allocator-for-%26A" class="anchor">§</a><h3 class="code-header">impl<A> <a class="trait" href="trait.Allocator.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator">Allocator</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&A</a><div class="where">where
|
||||
A: <a class="trait" href="trait.Allocator.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Allocator">Allocator</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></div><script src="../../../../../../../../../trait.impl/core/alloc/trait.Allocator.js" data-ignore-extern-crates="std,alloc" async></script></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
<!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="A memory allocator that can be registered as the standard library’s default through the `#[global_allocator]` attribute."><title>GlobalAlloc in cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Global<wbr>Alloc</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li><li><a href="#safety" title="Safety">Safety</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.alloc" title="alloc">alloc</a></li><li><a href="#tymethod.dealloc" title="dealloc">dealloc</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.alloc_zeroed" title="alloc_zeroed">alloc_zeroed</a></li><li><a href="#method.realloc" title="realloc">realloc</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Trait <span class="trait">GlobalAlloc</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/alloc/global.rs.html#119">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe trait GlobalAlloc {
|
||||
// Required methods
|
||||
unsafe fn <a href="#tymethod.alloc" class="fn">alloc</a>(&self, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>;
|
||||
<span class="item-spacer"></span> unsafe fn <a href="#tymethod.dealloc" class="fn">dealloc</a>(&self, ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>);
|
||||
|
||||
// Provided methods
|
||||
unsafe fn <a href="#method.alloc_zeroed" class="fn">alloc_zeroed</a>(&self, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a> { ... }
|
||||
<span class="item-spacer"></span> unsafe fn <a href="#method.realloc" class="fn">realloc</a>(
|
||||
&self,
|
||||
ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>,
|
||||
layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
new_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
|
||||
) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a> { ... }
|
||||
}</code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A memory allocator that can be registered as the standard library’s default
|
||||
through the <code>#[global_allocator]</code> attribute.</p>
|
||||
<p>Some of the methods require that a memory block be <em>currently
|
||||
allocated</em> via an allocator. This means that:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>the starting address for that memory block was previously
|
||||
returned by a previous call to an allocation method
|
||||
such as <code>alloc</code>, and</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>the memory block has not been subsequently deallocated, where
|
||||
blocks are deallocated either by being passed to a deallocation
|
||||
method such as <code>dealloc</code> or by being
|
||||
passed to a reallocation method that returns a non-null pointer.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::alloc::{GlobalAlloc, Layout};
|
||||
<span class="kw">use </span>std::cell::UnsafeCell;
|
||||
<span class="kw">use </span>std::ptr::null_mut;
|
||||
<span class="kw">use </span>std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
|
||||
|
||||
<span class="kw">const </span>ARENA_SIZE: usize = <span class="number">128 </span>* <span class="number">1024</span>;
|
||||
<span class="kw">const </span>MAX_SUPPORTED_ALIGN: usize = <span class="number">4096</span>;
|
||||
<span class="attr">#[repr(C, align(<span class="number">4096</span>))] </span><span class="comment">// 4096 == MAX_SUPPORTED_ALIGN
|
||||
</span><span class="kw">struct </span>SimpleAllocator {
|
||||
arena: UnsafeCell<[u8; ARENA_SIZE]>,
|
||||
remaining: AtomicUsize, <span class="comment">// we allocate from the top, counting down
|
||||
</span>}
|
||||
|
||||
<span class="attr">#[global_allocator]
|
||||
</span><span class="kw">static </span>ALLOCATOR: SimpleAllocator = SimpleAllocator {
|
||||
arena: UnsafeCell::new([<span class="number">0x55</span>; ARENA_SIZE]),
|
||||
remaining: AtomicUsize::new(ARENA_SIZE),
|
||||
};
|
||||
|
||||
<span class="kw">unsafe impl </span>Sync <span class="kw">for </span>SimpleAllocator {}
|
||||
|
||||
<span class="kw">unsafe impl </span>GlobalAlloc <span class="kw">for </span>SimpleAllocator {
|
||||
<span class="kw">unsafe fn </span>alloc(<span class="kw-2">&</span><span class="self">self</span>, layout: Layout) -> <span class="kw-2">*mut </span>u8 {
|
||||
<span class="kw">let </span>size = layout.size();
|
||||
<span class="kw">let </span>align = layout.align();
|
||||
|
||||
<span class="comment">// `Layout` contract forbids making a `Layout` with align=0, or align not power of 2.
|
||||
// So we can safely use a mask to ensure alignment without worrying about UB.
|
||||
</span><span class="kw">let </span>align_mask_to_round_down = !(align - <span class="number">1</span>);
|
||||
|
||||
<span class="kw">if </span>align > MAX_SUPPORTED_ALIGN {
|
||||
<span class="kw">return </span>null_mut();
|
||||
}
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>allocated = <span class="number">0</span>;
|
||||
<span class="kw">if </span><span class="self">self
|
||||
</span>.remaining
|
||||
.fetch_update(Relaxed, Relaxed, |<span class="kw-2">mut </span>remaining| {
|
||||
<span class="kw">if </span>size > remaining {
|
||||
<span class="kw">return </span><span class="prelude-val">None</span>;
|
||||
}
|
||||
remaining -= size;
|
||||
remaining &= align_mask_to_round_down;
|
||||
allocated = remaining;
|
||||
<span class="prelude-val">Some</span>(remaining)
|
||||
})
|
||||
.is_err()
|
||||
{
|
||||
<span class="kw">return </span>null_mut();
|
||||
};
|
||||
<span class="kw">unsafe </span>{ <span class="self">self</span>.arena.get().cast::<u8>().add(allocated) }
|
||||
}
|
||||
<span class="kw">unsafe fn </span>dealloc(<span class="kw-2">&</span><span class="self">self</span>, _ptr: <span class="kw-2">*mut </span>u8, _layout: Layout) {}
|
||||
}
|
||||
|
||||
<span class="kw">fn </span>main() {
|
||||
<span class="kw">let </span>_s = <span class="macro">format!</span>(<span class="string">"allocating a string!"</span>);
|
||||
<span class="kw">let </span>currently = ALLOCATOR.remaining.load(Relaxed);
|
||||
<span class="macro">println!</span>(<span class="string">"allocated so far: {}"</span>, ARENA_SIZE - currently);
|
||||
}</code></pre></div>
|
||||
<h2 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h2>
|
||||
<p>The <code>GlobalAlloc</code> trait is an <code>unsafe</code> trait for a number of reasons, and
|
||||
implementors must ensure that they adhere to these contracts:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>It’s undefined behavior if global allocators unwind. This restriction may
|
||||
be lifted in the future, but currently a panic from any of these
|
||||
functions may lead to memory unsafety.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>Layout</code> queries and calculations in general must be correct. Callers of
|
||||
this trait are allowed to rely on the contracts defined on each method,
|
||||
and implementors must ensure such contracts remain true.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>You must not rely on allocations actually happening, even if there are explicit
|
||||
heap allocations in the source. The optimizer may detect unused allocations that it can either
|
||||
eliminate entirely or move to the stack and thus never invoke the allocator. The
|
||||
optimizer may further assume that allocation is infallible, so code that used to fail due
|
||||
to allocator failures may now suddenly work because the optimizer worked around the
|
||||
need for an allocation. More concretely, the following code example is unsound, irrespective
|
||||
of whether your custom allocator allows counting how many allocations have happened.</p>
|
||||
|
||||
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested">ⓘ</a><pre class="rust rust-example-rendered"><code>drop(Box::new(<span class="number">42</span>));
|
||||
<span class="kw">let </span>number_of_heap_allocs = <span class="comment">/* call private allocator API */</span>;
|
||||
<span class="kw">unsafe </span>{ std::hint::assert_unchecked(number_of_heap_allocs > <span class="number">0</span>); }</code></pre></div>
|
||||
<p>Note that the optimizations mentioned above are not the only
|
||||
optimization that can be applied. You may generally not rely on heap allocations
|
||||
happening if they can be removed without changing program behavior.
|
||||
Whether allocations happen or not is not part of the program behavior, even if it
|
||||
could be detected via an allocator that tracks allocations by printing or otherwise
|
||||
having side effects.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.alloc" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.28.0">1.28.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/alloc/global.rs.html#153">Source</a></span><h4 class="code-header">unsafe fn <a href="#tymethod.alloc" class="fn">alloc</a>(&self, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Allocates memory as described by the given <code>layout</code>.</p>
|
||||
<p>Returns a pointer to newly-allocated memory,
|
||||
or null to indicate allocation failure.</p>
|
||||
<h5 id="safety-1"><a class="doc-anchor" href="#safety-1">§</a>Safety</h5>
|
||||
<p><code>layout</code> must have non-zero size. Attempting to allocate for a zero-sized <code>layout</code> may
|
||||
result in undefined behavior.</p>
|
||||
<p>(Extension subtraits might provide more specific bounds on
|
||||
behavior, e.g., guarantee a sentinel address or a null pointer
|
||||
in response to a zero-size allocation request.)</p>
|
||||
<p>The allocated block of memory may or may not be initialized.</p>
|
||||
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
||||
<p>Returning a null pointer indicates that either memory is exhausted
|
||||
or <code>layout</code> does not meet this allocator’s size or alignment constraints.</p>
|
||||
<p>Implementations are encouraged to return null on memory
|
||||
exhaustion rather than aborting, but this is not
|
||||
a strict requirement. (Specifically: it is <em>legal</em> to
|
||||
implement this trait atop an underlying native allocation
|
||||
library that aborts on memory exhaustion.)</p>
|
||||
<p>Clients wishing to abort computation in response to an
|
||||
allocation error are encouraged to call the <a href="../../alloc/alloc/fn.handle_alloc_error.html"><code>handle_alloc_error</code></a> function,
|
||||
rather than directly invoking <code>panic!</code> or similar.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.dealloc" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.28.0">1.28.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/alloc/global.rs.html#168">Source</a></span><h4 class="code-header">unsafe fn <a href="#tymethod.dealloc" class="fn">dealloc</a>(&self, ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>)</h4></section></summary><div class="docblock"><p>Deallocates the block of memory at the given <code>ptr</code> pointer with the given <code>layout</code>.</p>
|
||||
<h5 id="safety-2"><a class="doc-anchor" href="#safety-2">§</a>Safety</h5>
|
||||
<p>The caller must ensure:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>ptr</code> is a block of memory currently allocated via this allocator and,</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>layout</code> is the same layout that was used to allocate that block of
|
||||
memory.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Otherwise undefined behavior can result.</p>
|
||||
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.alloc_zeroed" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.28.0">1.28.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/alloc/global.rs.html#191">Source</a></span><h4 class="code-header">unsafe fn <a href="#method.alloc_zeroed" class="fn">alloc_zeroed</a>(&self, layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Behaves like <code>alloc</code>, but also ensures that the contents
|
||||
are set to zero before being returned.</p>
|
||||
<h5 id="safety-3"><a class="doc-anchor" href="#safety-3">§</a>Safety</h5>
|
||||
<p>The caller has to ensure that <code>layout</code> has non-zero size. Like <code>alloc</code>
|
||||
zero sized <code>layout</code> can result in undefined behavior.
|
||||
However the allocated block of memory is guaranteed to be initialized.</p>
|
||||
<h5 id="errors-1"><a class="doc-anchor" href="#errors-1">§</a>Errors</h5>
|
||||
<p>Returning a null pointer indicates that either memory is exhausted
|
||||
or <code>layout</code> does not meet allocator’s size or alignment constraints,
|
||||
just as in <code>alloc</code>.</p>
|
||||
<p>Clients wishing to abort computation in response to an
|
||||
allocation error are encouraged to call the <a href="../../alloc/alloc/fn.handle_alloc_error.html"><code>handle_alloc_error</code></a> function,
|
||||
rather than directly invoking <code>panic!</code> or similar.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.realloc" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.28.0">1.28.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/alloc/global.rs.html#261">Source</a></span><h4 class="code-header">unsafe fn <a href="#method.realloc" class="fn">realloc</a>(
|
||||
&self,
|
||||
ptr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>,
|
||||
layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout">Layout</a>,
|
||||
new_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
|
||||
) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Shrinks or grows a block of memory to the given <code>new_size</code> in bytes.
|
||||
The block is described by the given <code>ptr</code> pointer and <code>layout</code>.</p>
|
||||
<p>If this returns a non-null pointer, then ownership of the memory block
|
||||
referenced by <code>ptr</code> has been transferred to this allocator.
|
||||
Any access to the old <code>ptr</code> is Undefined Behavior, even if the
|
||||
allocation remained in-place. The newly returned pointer is the only valid pointer
|
||||
for accessing this memory now.</p>
|
||||
<p>The new memory block is allocated with <code>layout</code>,
|
||||
but with the <code>size</code> updated to <code>new_size</code> in bytes.
|
||||
This new layout must be used when deallocating the new memory block with <code>dealloc</code>.
|
||||
The range <code>0..min(layout.size(), new_size)</code> of the new memory block is
|
||||
guaranteed to have the same values as the original block.</p>
|
||||
<p>If this method returns null, then ownership of the memory
|
||||
block has not been transferred to this allocator, and the
|
||||
contents of the memory block are unaltered.</p>
|
||||
<h5 id="safety-4"><a class="doc-anchor" href="#safety-4">§</a>Safety</h5>
|
||||
<p>The caller must ensure that:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>ptr</code> is allocated via this allocator,</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>layout</code> is the same layout that was used
|
||||
to allocate that block of memory,</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>new_size</code> is greater than zero.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>new_size</code>, when rounded up to the nearest multiple of <code>layout.align()</code>,
|
||||
does not overflow <code>isize</code> (i.e., the rounded value must be less than or
|
||||
equal to <code>isize::MAX</code>).</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>If these are not followed, undefined behavior can result.</p>
|
||||
<p>(Extension subtraits might provide more specific bounds on
|
||||
behavior, e.g., guarantee a sentinel address or a null pointer
|
||||
in response to a zero-size allocation request.)</p>
|
||||
<h5 id="errors-2"><a class="doc-anchor" href="#errors-2">§</a>Errors</h5>
|
||||
<p>Returns null if the new layout does not meet the size
|
||||
and alignment constraints of the allocator, or if reallocation
|
||||
otherwise fails.</p>
|
||||
<p>Implementations are encouraged to return null on memory
|
||||
exhaustion rather than panicking or aborting, but this is not
|
||||
a strict requirement. (Specifically: it is <em>legal</em> to
|
||||
implement this trait atop an underlying native allocation
|
||||
library that aborts on memory exhaustion.)</p>
|
||||
<p>Clients wishing to abort computation in response to a
|
||||
reallocation error are encouraged to call the <a href="../../alloc/alloc/fn.handle_alloc_error.html"><code>handle_alloc_error</code></a> function,
|
||||
rather than directly invoking <code>panic!</code> or similar.</p>
|
||||
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-GlobalAlloc-for-System" class="impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.28.0">1.28.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/std/sys/alloc/unix.rs.html#6">Source</a></span><a href="#impl-GlobalAlloc-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.GlobalAlloc.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::GlobalAlloc">GlobalAlloc</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/alloc/struct.System.html" title="struct std::alloc::System">System</a></h3></section></div><script src="../../../../../../../../../trait.impl/core/alloc/global/trait.GlobalAlloc.js" data-ignore-extern-crates="std" async></script></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<!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 `LayoutErr` type in crate `cosmic`."><title>LayoutErr in cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc type"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Layout<wbr>Err</a></h2><h3><a href="#aliased-type">Aliased Type</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a>::<wbr><a href="index.html">alloc</a></div><h1>Type Alias <span class="type">LayoutErr</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/alloc/layout.rs.html#540">Source</a> </span></div><pre class="rust item-decl"><code>pub type LayoutErr = <a class="struct" href="struct.LayoutError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::LayoutError">LayoutError</a>;</code></pre><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.52.0: Name does not follow std convention, use LayoutError</span></div><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><h2 id="aliased-type" class="section-header">Aliased Type<a href="#aliased-type" class="anchor">§</a></h2><pre class="rust item-decl"><code>pub struct LayoutErr;</code></pre><script src="../../../../../../../../../type.impl/cosmic/cctk/sctk/reexports/client/backend/smallvec/alloc/alloc/struct.LayoutError.js" data-self-path="cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::LayoutErr" async></script></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,2 @@
|
|||
<!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="A module for working with borrowed data."><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::borrow - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module borrow</a></h2><h3><a href="#enums">Module Items</a></h3><ul class="block"><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a></div><h1>Module <span>borrow</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/lib.rs.html#216">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A module for working with borrowed data.</p>
|
||||
</div></details><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Cow.html" title="enum cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::borrow::Cow">Cow</a></dt><dd>A clone-on-write smart pointer.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Borrow.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::borrow::Borrow">Borrow</a></dt><dd>A trait for borrowing data.</dd><dt><a class="trait" href="trait.BorrowMut.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::borrow::BorrowMut">Borrow<wbr>Mut</a></dt><dd>A trait for mutably borrowing data.</dd><dt><a class="trait" href="trait.ToOwned.html" title="trait cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::borrow::ToOwned">ToOwned</a></dt><dd>A generalization of <code>Clone</code> to borrowed data.</dd></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"enum":["Cow"],"trait":["Borrow","BorrowMut","ToOwned"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,4 @@
|
|||
<!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="Constructs a `Box<T>` by calling the `exchange_malloc` lang item and moving the argument into the newly allocated memory. This is an intrinsic to avoid unnecessary copies."><title>box_new in cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>boxed</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a>::<wbr><a href="index.html">boxed</a></div><h1>Function <span class="fn">box_new</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/boxed.rs.html#242">Source</a> </span></div><pre class="rust item-decl"><code>pub fn box_new<T>(x: T) -> <a class="struct" href="struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a><T></code></pre><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>liballoc_internals</code>)</span></div><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Constructs a <code>Box<T></code> by calling the <code>exchange_malloc</code> lang item and moving the argument into
|
||||
the newly allocated memory. This is an intrinsic to avoid unnecessary copies.</p>
|
||||
<p>This is the surface syntax for <code>box <expr></code> expressions.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
<!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="The `Box<T>` type for heap allocation."><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module boxed</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li><li><a href="#memory-layout" title="Memory layout">Memory layout</a></li><li><a href="#considerations-for-unsafe-code" title="Considerations for unsafe code">Considerations for unsafe code</a></li><li><a href="#editions" title="Editions">Editions</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a></div><h1>Module <span>boxed</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/lib.rs.html#217">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The <code>Box<T></code> type for heap allocation.</p>
|
||||
<p><a href="struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box"><code>Box<T></code></a>, casually referred to as a ‘box’, provides the simplest form of
|
||||
heap allocation in Rust. Boxes provide ownership for this allocation, and
|
||||
drop their contents when they go out of scope. Boxes also ensure that they
|
||||
never allocate more than <code>isize::MAX</code> bytes.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<p>Move a value from the stack to the heap by creating a <a href="struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box"><code>Box</code></a>:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>val: u8 = <span class="number">5</span>;
|
||||
<span class="kw">let </span>boxed: Box<u8> = Box::new(val);</code></pre></div>
|
||||
<p>Move a value from a <a href="struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box"><code>Box</code></a> back to the stack by <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">dereferencing</a>:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>boxed: Box<u8> = Box::new(<span class="number">5</span>);
|
||||
<span class="kw">let </span>val: u8 = <span class="kw-2">*</span>boxed;</code></pre></div>
|
||||
<p>Creating a recursive data structure:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[derive(Debug)]
|
||||
</span><span class="kw">enum </span>List<T> {
|
||||
Cons(T, Box<List<T>>),
|
||||
Nil,
|
||||
}
|
||||
|
||||
<span class="kw">let </span>list: List<i32> = List::Cons(<span class="number">1</span>, Box::new(List::Cons(<span class="number">2</span>, Box::new(List::Nil))));
|
||||
<span class="macro">println!</span>(<span class="string">"{list:?}"</span>);</code></pre></div>
|
||||
<p>This will print <code>Cons(1, Cons(2, Nil))</code>.</p>
|
||||
<p>Recursive structures must be boxed, because if the definition of <code>Cons</code>
|
||||
looked like this:</p>
|
||||
|
||||
<div class="example-wrap compile_fail"><a href="#" class="tooltip" title="This example deliberately fails to compile">ⓘ</a><pre class="rust rust-example-rendered"><code>Cons(T, List<T>),</code></pre></div>
|
||||
<p>It wouldn’t work. This is because the size of a <code>List</code> depends on how many
|
||||
elements are in the list, and so we don’t know how much memory to allocate
|
||||
for a <code>Cons</code>. By introducing a <a href="struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box"><code>Box<T></code></a>, which has a defined size, we know how
|
||||
big <code>Cons</code> needs to be.</p>
|
||||
<h2 id="memory-layout"><a class="doc-anchor" href="#memory-layout">§</a>Memory layout</h2>
|
||||
<p>For non-zero-sized values, a <a href="struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box"><code>Box</code></a> will use the <a href="../alloc/struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global"><code>Global</code></a> allocator for its allocation. It is
|
||||
valid to convert both ways between a <a href="struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box"><code>Box</code></a> and a raw pointer allocated with the <a href="../alloc/struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global"><code>Global</code></a>
|
||||
allocator, given that the <a href="../alloc/struct.Layout.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout"><code>Layout</code></a> used with the allocator is correct for the type and the raw
|
||||
pointer points to a valid value of the right type. More precisely, a <code>value: *mut T</code> that has
|
||||
been allocated with the <a href="../alloc/struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global"><code>Global</code></a> allocator with <code>Layout::for_value(&*value)</code> may be converted
|
||||
into a box using <a href="struct.Box.html#method.from_raw" title="associated function cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box::from_raw"><code>Box::<T>::from_raw(value)</code></a>. Conversely, the memory backing a <code>value: *mut T</code>
|
||||
obtained from <a href="struct.Box.html#method.into_raw" title="associated function cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box::into_raw"><code>Box::<T>::into_raw</code></a> may be deallocated using the <a href="../alloc/struct.Global.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Global"><code>Global</code></a> allocator with
|
||||
<a href="../alloc/struct.Layout.html#method.for_value" title="associated function cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::alloc::Layout::for_value"><code>Layout::for_value(&*value)</code></a>.</p>
|
||||
<p>For zero-sized values, the <code>Box</code> pointer has to be non-null and sufficiently aligned. The
|
||||
recommended way to build a Box to a ZST if <code>Box::new</code> cannot be used is to use
|
||||
<a href="https://doc.rust-lang.org/nightly/core/ptr/non_null/struct.NonNull.html#method.dangling" title="associated function core::ptr::non_null::NonNull::dangling"><code>ptr::NonNull::dangling</code></a>.</p>
|
||||
<p>On top of these basic layout requirements, a <code>Box<T></code> must point to a valid value of <code>T</code>.</p>
|
||||
<p>So long as <code>T: Sized</code>, a <code>Box<T></code> is guaranteed to be represented
|
||||
as a single pointer and is also ABI-compatible with C pointers
|
||||
(i.e. the C type <code>T*</code>). This means that if you have extern “C”
|
||||
Rust functions that will be called from C, you can define those
|
||||
Rust functions using <code>Box<T></code> types, and use <code>T*</code> as corresponding
|
||||
type on the C side. As an example, consider this C header which
|
||||
declares functions that create and destroy some kind of <code>Foo</code>
|
||||
value:</p>
|
||||
<div class="example-wrap"><pre class="language-c"><code>/* C header */
|
||||
|
||||
/* Returns ownership to the caller */
|
||||
struct Foo* foo_new(void);
|
||||
|
||||
/* Takes ownership from the caller; no-op when invoked with null */
|
||||
void foo_delete(struct Foo*);</code></pre></div>
|
||||
<p>These two functions might be implemented in Rust as follows. Here, the
|
||||
<code>struct Foo*</code> type from C is translated to <code>Box<Foo></code>, which captures
|
||||
the ownership constraints. Note also that the nullable argument to
|
||||
<code>foo_delete</code> is represented in Rust as <code>Option<Box<Foo>></code>, since <code>Box<Foo></code>
|
||||
cannot be null.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#[repr(C)]
|
||||
</span><span class="kw">pub struct </span>Foo;
|
||||
|
||||
<span class="attr">#[<span class="kw">unsafe</span>(no_mangle)]
|
||||
</span><span class="kw">pub extern </span><span class="string">"C" </span><span class="kw">fn </span>foo_new() -> Box<Foo> {
|
||||
Box::new(Foo)
|
||||
}
|
||||
|
||||
<span class="attr">#[<span class="kw">unsafe</span>(no_mangle)]
|
||||
</span><span class="kw">pub extern </span><span class="string">"C" </span><span class="kw">fn </span>foo_delete(<span class="kw">_</span>: <span class="prelude-ty">Option</span><Box<Foo>>) {}</code></pre></div>
|
||||
<p>Even though <code>Box<T></code> has the same representation and C ABI as a C pointer,
|
||||
this does not mean that you can convert an arbitrary <code>T*</code> into a <code>Box<T></code>
|
||||
and expect things to work. <code>Box<T></code> values will always be fully aligned,
|
||||
non-null pointers. Moreover, the destructor for <code>Box<T></code> will attempt to
|
||||
free the value with the global allocator. In general, the best practice
|
||||
is to only use <code>Box<T></code> for pointers that originated from the global
|
||||
allocator.</p>
|
||||
<p><strong>Important.</strong> At least at present, you should avoid using
|
||||
<code>Box<T></code> types for functions that are defined in C but invoked
|
||||
from Rust. In those cases, you should directly mirror the C types
|
||||
as closely as possible. Using types like <code>Box<T></code> where the C
|
||||
definition is just using <code>T*</code> can lead to undefined behavior, as
|
||||
described in <a href="https://github.com/rust-lang/unsafe-code-guidelines/issues/198">rust-lang/unsafe-code-guidelines#198</a>.</p>
|
||||
<h2 id="considerations-for-unsafe-code"><a class="doc-anchor" href="#considerations-for-unsafe-code">§</a>Considerations for unsafe code</h2>
|
||||
<p><strong>Warning: This section is not normative and is subject to change, possibly
|
||||
being relaxed in the future! It is a simplified summary of the rules
|
||||
currently implemented in the compiler.</strong></p>
|
||||
<p>The aliasing rules for <code>Box<T></code> are the same as for <code>&mut T</code>. <code>Box<T></code>
|
||||
asserts uniqueness over its content. Using raw pointers derived from a box
|
||||
after that box has been mutated through, moved or borrowed as <code>&mut T</code>
|
||||
is not allowed. For more guidance on working with box from unsafe code, see
|
||||
<a href="https://github.com/rust-lang/unsafe-code-guidelines/issues/326">rust-lang/unsafe-code-guidelines#326</a>.</p>
|
||||
<h2 id="editions"><a class="doc-anchor" href="#editions">§</a>Editions</h2>
|
||||
<p>A special case exists for the implementation of <code>IntoIterator</code> for arrays on the Rust 2021
|
||||
edition, as documented <a href="https://doc.rust-lang.org/nightly/std/primitive.array.html" title="primitive array">here</a>. Unfortunately, it was later found that a similar
|
||||
workaround should be added for boxed slices, and this was applied in the 2024 edition.</p>
|
||||
<p>Specifically, <code>IntoIterator</code> is implemented for <code>Box<[T]></code> on all editions, but specific calls
|
||||
to <code>into_iter()</code> for boxed slices will defer to the slice implementation on editions before
|
||||
2024:</p>
|
||||
|
||||
<div class="example-wrap edition"><a href="#" class="tooltip" title="This example runs with edition 2021">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="comment">// Rust 2015, 2018, and 2021:
|
||||
|
||||
</span><span class="kw">let </span>boxed_slice: Box<[i32]> = <span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">3</span>].into_boxed_slice();
|
||||
|
||||
<span class="comment">// This creates a slice iterator, producing references to each value.
|
||||
</span><span class="kw">for </span>item <span class="kw">in </span>boxed_slice.into_iter().enumerate() {
|
||||
<span class="kw">let </span>(i, x): (usize, <span class="kw-2">&</span>i32) = item;
|
||||
<span class="macro">println!</span>(<span class="string">"boxed_slice[{i}] = {x}"</span>);
|
||||
}
|
||||
|
||||
<span class="comment">// The `boxed_slice_into_iter` lint suggests this change for future compatibility:
|
||||
</span><span class="kw">for </span>item <span class="kw">in </span>boxed_slice.iter().enumerate() {
|
||||
<span class="kw">let </span>(i, x): (usize, <span class="kw-2">&</span>i32) = item;
|
||||
<span class="macro">println!</span>(<span class="string">"boxed_slice[{i}] = {x}"</span>);
|
||||
}
|
||||
|
||||
<span class="comment">// You can explicitly iterate a boxed slice by value using `IntoIterator::into_iter`
|
||||
</span><span class="kw">for </span>item <span class="kw">in </span>IntoIterator::into_iter(boxed_slice).enumerate() {
|
||||
<span class="kw">let </span>(i, x): (usize, i32) = item;
|
||||
<span class="macro">println!</span>(<span class="string">"boxed_slice[{i}] = {x}"</span>);
|
||||
}</code></pre></div>
|
||||
<p>Similar to the array implementation, this may be modified in the future to remove this override,
|
||||
and it’s best to avoid relying on this edition-dependent behavior if you wish to preserve
|
||||
compatibility with future versions of the compiler.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Box.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::Box">Box</a></dt><dd>A pointer type that uniquely owns a heap allocation of type <code>T</code>.</dd><dt><a class="struct" href="struct.ThinBox.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::ThinBox">ThinBox</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>ThinBox.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.box_new.html" title="fn cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::boxed::box_new">box_new</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>Constructs a <code>Box<T></code> by calling the <code>exchange_malloc</code> lang item and moving the argument into
|
||||
the newly allocated memory. This is an intrinsic to avoid unnecessary copies.</dd></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"fn":["box_new"],"struct":["Box","ThinBox"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,4 @@
|
|||
<!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="The `ByteStr` and `ByteString` types and trait implementations."><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::bstr - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module bstr</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a></div><h1>Module <span>bstr</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/lib.rs.html#219">Source</a> </span></div><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>bstr</code>)</span></div><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The <code>ByteStr</code> and <code>ByteString</code> types and trait implementations.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.ByteStr.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::bstr::ByteStr">ByteStr</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A wrapper for <code>&[u8]</code> representing a human-readable string that’s conventionally, but not
|
||||
always, UTF-8.</dd><dt><a class="struct" href="struct.ByteString.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::bstr::ByteString">Byte<wbr>String</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A wrapper for <code>Vec<u8></code> representing a human-readable string that’s conventionally, but not
|
||||
always, UTF-8.</dd></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["ByteStr","ByteString"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,134 @@
|
|||
<!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="A priority queue implemented with a binary heap."><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::binary_heap - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../../" data-static-root-path="../../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module binary_<wbr>heap</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>collections</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../../index.html">reexports</a>::<wbr><a href="../../../../../index.html">client</a>::<wbr><a href="../../../../index.html">backend</a>::<wbr><a href="../../../index.html">smallvec</a>::<wbr><a href="../../index.html">alloc</a>::<wbr><a href="../index.html">collections</a></div><h1>Module <span>binary_heap</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/collections/mod.rs.html#9">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A priority queue implemented with a binary heap.</p>
|
||||
<p>Insertion and popping the largest element have <em>O</em>(log(<em>n</em>)) time complexity.
|
||||
Checking the largest element is <em>O</em>(1). Converting a vector to a binary heap
|
||||
can be done in-place, and has <em>O</em>(<em>n</em>) complexity. A binary heap can also be
|
||||
converted to a sorted vector in-place, allowing it to be used for an <em>O</em>(<em>n</em> * log(<em>n</em>))
|
||||
in-place heapsort.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<p>This is a larger example that implements <a href="https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm">Dijkstra’s algorithm</a>
|
||||
to solve the <a href="https://en.wikipedia.org/wiki/Shortest_path_problem">shortest path problem</a> on a <a href="https://en.wikipedia.org/wiki/Directed_graph">directed graph</a>.
|
||||
It shows how to use <a href="../struct.BinaryHeap.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::BinaryHeap"><code>BinaryHeap</code></a> with custom types.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::cmp::Ordering;
|
||||
<span class="kw">use </span>std::collections::BinaryHeap;
|
||||
|
||||
<span class="attr">#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
</span><span class="kw">struct </span>State {
|
||||
cost: usize,
|
||||
position: usize,
|
||||
}
|
||||
|
||||
<span class="comment">// The priority queue depends on `Ord`.
|
||||
// Explicitly implement the trait so the queue becomes a min-heap
|
||||
// instead of a max-heap.
|
||||
</span><span class="kw">impl </span>Ord <span class="kw">for </span>State {
|
||||
<span class="kw">fn </span>cmp(<span class="kw-2">&</span><span class="self">self</span>, other: <span class="kw-2">&</span><span class="self">Self</span>) -> Ordering {
|
||||
<span class="comment">// Notice that we flip the ordering on costs.
|
||||
// In case of a tie we compare positions - this step is necessary
|
||||
// to make implementations of `PartialEq` and `Ord` consistent.
|
||||
</span>other.cost.cmp(<span class="kw-2">&</span><span class="self">self</span>.cost)
|
||||
.then_with(|| <span class="self">self</span>.position.cmp(<span class="kw-2">&</span>other.position))
|
||||
}
|
||||
}
|
||||
|
||||
<span class="comment">// `PartialOrd` needs to be implemented as well.
|
||||
</span><span class="kw">impl </span>PartialOrd <span class="kw">for </span>State {
|
||||
<span class="kw">fn </span>partial_cmp(<span class="kw-2">&</span><span class="self">self</span>, other: <span class="kw-2">&</span><span class="self">Self</span>) -> <span class="prelude-ty">Option</span><Ordering> {
|
||||
<span class="prelude-val">Some</span>(<span class="self">self</span>.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
<span class="comment">// Each node is represented as a `usize`, for a shorter implementation.
|
||||
</span><span class="kw">struct </span>Edge {
|
||||
node: usize,
|
||||
cost: usize,
|
||||
}
|
||||
|
||||
<span class="comment">// Dijkstra's shortest path algorithm.
|
||||
|
||||
// Start at `start` and use `dist` to track the current shortest distance
|
||||
// to each node. This implementation isn't memory-efficient as it may leave duplicate
|
||||
// nodes in the queue. It also uses `usize::MAX` as a sentinel value,
|
||||
// for a simpler implementation.
|
||||
</span><span class="kw">fn </span>shortest_path(adj_list: <span class="kw-2">&</span>Vec<Vec<Edge>>, start: usize, goal: usize) -> <span class="prelude-ty">Option</span><usize> {
|
||||
<span class="comment">// dist[node] = current shortest distance from `start` to `node`
|
||||
</span><span class="kw">let </span><span class="kw-2">mut </span>dist: Vec<<span class="kw">_</span>> = (<span class="number">0</span>..adj_list.len()).map(|<span class="kw">_</span>| usize::MAX).collect();
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>heap = BinaryHeap::new();
|
||||
|
||||
<span class="comment">// We're at `start`, with a zero cost
|
||||
</span>dist[start] = <span class="number">0</span>;
|
||||
heap.push(State { cost: <span class="number">0</span>, position: start });
|
||||
|
||||
<span class="comment">// Examine the frontier with lower cost nodes first (min-heap)
|
||||
</span><span class="kw">while let </span><span class="prelude-val">Some</span>(State { cost, position }) = heap.pop() {
|
||||
<span class="comment">// Alternatively we could have continued to find all shortest paths
|
||||
</span><span class="kw">if </span>position == goal { <span class="kw">return </span><span class="prelude-val">Some</span>(cost); }
|
||||
|
||||
<span class="comment">// Important as we may have already found a better way
|
||||
</span><span class="kw">if </span>cost > dist[position] { <span class="kw">continue</span>; }
|
||||
|
||||
<span class="comment">// For each node we can reach, see if we can find a way with
|
||||
// a lower cost going through this node
|
||||
</span><span class="kw">for </span>edge <span class="kw">in </span><span class="kw-2">&</span>adj_list[position] {
|
||||
<span class="kw">let </span>next = State { cost: cost + edge.cost, position: edge.node };
|
||||
|
||||
<span class="comment">// If so, add it to the frontier and continue
|
||||
</span><span class="kw">if </span>next.cost < dist[next.position] {
|
||||
heap.push(next);
|
||||
<span class="comment">// Relaxation, we have now found a better way
|
||||
</span>dist[next.position] = next.cost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="comment">// Goal not reachable
|
||||
</span><span class="prelude-val">None
|
||||
</span>}
|
||||
|
||||
<span class="kw">fn </span>main() {
|
||||
<span class="comment">// This is the directed graph we're going to use.
|
||||
// The node numbers correspond to the different states,
|
||||
// and the edge weights symbolize the cost of moving
|
||||
// from one node to another.
|
||||
// Note that the edges are one-way.
|
||||
//
|
||||
// 7
|
||||
// +-----------------+
|
||||
// | |
|
||||
// v 1 2 | 2
|
||||
// 0 -----> 1 -----> 3 ---> 4
|
||||
// | ^ ^ ^
|
||||
// | | 1 | |
|
||||
// | | | 3 | 1
|
||||
// +------> 2 -------+ |
|
||||
// 10 | |
|
||||
// +---------------+
|
||||
//
|
||||
// The graph is represented as an adjacency list where each index,
|
||||
// corresponding to a node value, has a list of outgoing edges.
|
||||
// Chosen for its efficiency.
|
||||
</span><span class="kw">let </span>graph = <span class="macro">vec!</span>[
|
||||
<span class="comment">// Node 0
|
||||
</span><span class="macro">vec!</span>[Edge { node: <span class="number">2</span>, cost: <span class="number">10 </span>},
|
||||
Edge { node: <span class="number">1</span>, cost: <span class="number">1 </span>}],
|
||||
<span class="comment">// Node 1
|
||||
</span><span class="macro">vec!</span>[Edge { node: <span class="number">3</span>, cost: <span class="number">2 </span>}],
|
||||
<span class="comment">// Node 2
|
||||
</span><span class="macro">vec!</span>[Edge { node: <span class="number">1</span>, cost: <span class="number">1 </span>},
|
||||
Edge { node: <span class="number">3</span>, cost: <span class="number">3 </span>},
|
||||
Edge { node: <span class="number">4</span>, cost: <span class="number">1 </span>}],
|
||||
<span class="comment">// Node 3
|
||||
</span><span class="macro">vec!</span>[Edge { node: <span class="number">0</span>, cost: <span class="number">7 </span>},
|
||||
Edge { node: <span class="number">4</span>, cost: <span class="number">2 </span>}],
|
||||
<span class="comment">// Node 4
|
||||
</span><span class="macro">vec!</span>[]];
|
||||
|
||||
<span class="macro">assert_eq!</span>(shortest_path(<span class="kw-2">&</span>graph, <span class="number">0</span>, <span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="number">1</span>));
|
||||
<span class="macro">assert_eq!</span>(shortest_path(<span class="kw-2">&</span>graph, <span class="number">0</span>, <span class="number">3</span>), <span class="prelude-val">Some</span>(<span class="number">3</span>));
|
||||
<span class="macro">assert_eq!</span>(shortest_path(<span class="kw-2">&</span>graph, <span class="number">3</span>, <span class="number">0</span>), <span class="prelude-val">Some</span>(<span class="number">7</span>));
|
||||
<span class="macro">assert_eq!</span>(shortest_path(<span class="kw-2">&</span>graph, <span class="number">0</span>, <span class="number">4</span>), <span class="prelude-val">Some</span>(<span class="number">5</span>));
|
||||
<span class="macro">assert_eq!</span>(shortest_path(<span class="kw-2">&</span>graph, <span class="number">4</span>, <span class="number">0</span>), <span class="prelude-val">None</span>);
|
||||
}</code></pre></div>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BinaryHeap.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::binary_heap::BinaryHeap">Binary<wbr>Heap</a></dt><dd>A priority queue implemented with a binary heap.</dd><dt><a class="struct" href="struct.Drain.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::binary_heap::Drain">Drain</a></dt><dd>A draining iterator over the elements of a <code>BinaryHeap</code>.</dd><dt><a class="struct" href="struct.IntoIter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::binary_heap::IntoIter">Into<wbr>Iter</a></dt><dd>An owning iterator over the elements of a <code>BinaryHeap</code>.</dd><dt><a class="struct" href="struct.Iter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::binary_heap::Iter">Iter</a></dt><dd>An iterator over the elements of a <code>BinaryHeap</code>.</dd><dt><a class="struct" href="struct.PeekMut.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::binary_heap::PeekMut">PeekMut</a></dt><dd>Structure wrapping a mutable reference to the greatest item on a
|
||||
<code>BinaryHeap</code>.</dd><dt><a class="struct" href="struct.DrainSorted.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::binary_heap::DrainSorted">Drain<wbr>Sorted</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A draining iterator over the elements of a <code>BinaryHeap</code>.</dd><dt><a class="struct" href="struct.IntoIterSorted.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::binary_heap::IntoIterSorted">Into<wbr>Iter<wbr>Sorted</a><wbr><span class="stab unstable" title="">Experimental</span></dt></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["BinaryHeap","Drain","DrainSorted","IntoIter","IntoIterSorted","Iter","PeekMut"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,7 @@
|
|||
<!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="An ordered map based on a B-Tree."><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../../" data-static-root-path="../../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module btree_<wbr>map</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>collections</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../../index.html">reexports</a>::<wbr><a href="../../../../../index.html">client</a>::<wbr><a href="../../../../index.html">backend</a>::<wbr><a href="../../../index.html">smallvec</a>::<wbr><a href="../../index.html">alloc</a>::<wbr><a href="../index.html">collections</a></div><h1>Module <span>btree_map</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/collections/mod.rs.html#19">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An ordered map based on a B-Tree.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BTreeMap.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::BTreeMap">BTree<wbr>Map</a></dt><dd>An ordered map based on a <a href="https://en.wikipedia.org/wiki/B-tree">B-Tree</a>.</dd><dt><a class="struct" href="struct.IntoIter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::IntoIter">Into<wbr>Iter</a></dt><dd>An owning iterator over the entries of a <code>BTreeMap</code>, sorted by key.</dd><dt><a class="struct" href="struct.IntoKeys.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::IntoKeys">Into<wbr>Keys</a></dt><dd>An owning iterator over the keys of a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.IntoValues.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::IntoValues">Into<wbr>Values</a></dt><dd>An owning iterator over the values of a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.Iter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::Iter">Iter</a></dt><dd>An iterator over the entries of a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.IterMut.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::IterMut">IterMut</a></dt><dd>A mutable iterator over the entries of a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.Keys.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::Keys">Keys</a></dt><dd>An iterator over the keys of a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.OccupiedEntry.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::OccupiedEntry">Occupied<wbr>Entry</a></dt><dd>A view into an occupied entry in a <code>BTreeMap</code>.
|
||||
It is part of the <a href="enum.Entry.html" title="enum cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::Entry"><code>Entry</code></a> enum.</dd><dt><a class="struct" href="struct.Range.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::Range">Range</a></dt><dd>An iterator over a sub-range of entries in a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.RangeMut.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::RangeMut">Range<wbr>Mut</a></dt><dd>A mutable iterator over a sub-range of entries in a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.VacantEntry.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::VacantEntry">Vacant<wbr>Entry</a></dt><dd>A view into a vacant entry in a <code>BTreeMap</code>.
|
||||
It is part of the <a href="enum.Entry.html" title="enum cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::Entry"><code>Entry</code></a> enum.</dd><dt><a class="struct" href="struct.Values.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::Values">Values</a></dt><dd>An iterator over the values of a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.ValuesMut.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::ValuesMut">Values<wbr>Mut</a></dt><dd>A mutable iterator over the values of a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.Cursor.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::Cursor">Cursor</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A cursor over a <code>BTreeMap</code>.</dd><dt><a class="struct" href="struct.CursorMut.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::CursorMut">Cursor<wbr>Mut</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A cursor over a <code>BTreeMap</code> with editing operations.</dd><dt><a class="struct" href="struct.CursorMutKey.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::CursorMutKey">Cursor<wbr>MutKey</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A cursor over a <code>BTreeMap</code> with editing operations, and which allows
|
||||
mutating the key of elements.</dd><dt><a class="struct" href="struct.ExtractIf.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::ExtractIf">Extract<wbr>If</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>An iterator produced by calling <code>extract_if</code> on BTreeMap.</dd><dt><a class="struct" href="struct.OccupiedError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::OccupiedError">Occupied<wbr>Error</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>The error returned by <a href="../struct.BTreeMap.html#method.try_insert" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::BTreeMap::try_insert"><code>try_insert</code></a> when the key already exists.</dd><dt><a class="struct" href="struct.UnorderedKeyError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::UnorderedKeyError">Unordered<wbr>KeyError</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>Error type returned by <a href="struct.CursorMut.html#method.insert_before" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::CursorMut::insert_before"><code>CursorMut::insert_before</code></a> and
|
||||
<a href="struct.CursorMut.html#method.insert_after" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::CursorMut::insert_after"><code>CursorMut::insert_after</code></a> if the key being inserted is not properly
|
||||
ordered with regards to adjacent keys.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Entry.html" title="enum cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::Entry">Entry</a></dt><dd>A view into a single entry in a map, which may either be vacant or occupied.</dd></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"enum":["Entry"],"struct":["BTreeMap","Cursor","CursorMut","CursorMutKey","ExtractIf","IntoIter","IntoKeys","IntoValues","Iter","IterMut","Keys","OccupiedEntry","OccupiedError","Range","RangeMut","UnorderedKeyError","VacantEntry","Values","ValuesMut"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,7 @@
|
|||
<!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="An ordered set based on a B-Tree."><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../../" data-static-root-path="../../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module btree_<wbr>set</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>collections</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../../index.html">reexports</a>::<wbr><a href="../../../../../index.html">client</a>::<wbr><a href="../../../../index.html">backend</a>::<wbr><a href="../../../index.html">smallvec</a>::<wbr><a href="../../index.html">alloc</a>::<wbr><a href="../index.html">collections</a></div><h1>Module <span>btree_set</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/collections/mod.rs.html#27">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An ordered set based on a B-Tree.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BTreeSet.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::BTreeSet">BTree<wbr>Set</a></dt><dd>An ordered set based on a B-Tree.</dd><dt><a class="struct" href="struct.Difference.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::Difference">Difference</a></dt><dd>A lazy iterator producing elements in the difference of <code>BTreeSet</code>s.</dd><dt><a class="struct" href="struct.Intersection.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::Intersection">Intersection</a></dt><dd>A lazy iterator producing elements in the intersection of <code>BTreeSet</code>s.</dd><dt><a class="struct" href="struct.IntoIter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::IntoIter">Into<wbr>Iter</a></dt><dd>An owning iterator over the items of a <code>BTreeSet</code> in ascending order.</dd><dt><a class="struct" href="struct.Iter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::Iter">Iter</a></dt><dd>An iterator over the items of a <code>BTreeSet</code>.</dd><dt><a class="struct" href="struct.Range.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::Range">Range</a></dt><dd>An iterator over a sub-range of items in a <code>BTreeSet</code>.</dd><dt><a class="struct" href="struct.SymmetricDifference.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::SymmetricDifference">Symmetric<wbr>Difference</a></dt><dd>A lazy iterator producing elements in the symmetric difference of <code>BTreeSet</code>s.</dd><dt><a class="struct" href="struct.Union.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::Union">Union</a></dt><dd>A lazy iterator producing elements in the union of <code>BTreeSet</code>s.</dd><dt><a class="struct" href="struct.Cursor.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::Cursor">Cursor</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A cursor over a <code>BTreeSet</code>.</dd><dt><a class="struct" href="struct.CursorMut.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::CursorMut">Cursor<wbr>Mut</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A cursor over a <code>BTreeSet</code> with editing operations.</dd><dt><a class="struct" href="struct.CursorMutKey.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::CursorMutKey">Cursor<wbr>MutKey</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A cursor over a <code>BTreeSet</code> with editing operations, and which allows
|
||||
mutating elements.</dd><dt><a class="struct" href="struct.ExtractIf.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::ExtractIf">Extract<wbr>If</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>An iterator produced by calling <code>extract_if</code> on BTreeSet.</dd><dt><a class="struct" href="struct.OccupiedEntry.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::OccupiedEntry">Occupied<wbr>Entry</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A view into an occupied entry in a <code>BTreeSet</code>.
|
||||
It is part of the <a href="enum.Entry.html" title="enum cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::Entry"><code>Entry</code></a> enum.</dd><dt><a class="struct" href="struct.UnorderedKeyError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::UnorderedKeyError">Unordered<wbr>KeyError</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>Error type returned by <a href="../btree_map/struct.CursorMut.html#method.insert_before" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::CursorMut::insert_before"><code>CursorMut::insert_before</code></a> and
|
||||
<a href="../btree_map/struct.CursorMut.html#method.insert_after" title="method cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map::CursorMut::insert_after"><code>CursorMut::insert_after</code></a> if the key being inserted is not properly
|
||||
ordered with regards to adjacent keys.</dd><dt><a class="struct" href="struct.VacantEntry.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::VacantEntry">Vacant<wbr>Entry</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A view into a vacant entry in a <code>BTreeSet</code>.
|
||||
It is part of the <a href="enum.Entry.html" title="enum cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::Entry"><code>Entry</code></a> enum.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Entry.html" title="enum cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set::Entry">Entry</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A view into a single entry in a set, which may either be vacant or occupied.</dd></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"enum":["Entry"],"struct":["BTreeSet","Cursor","CursorMut","CursorMutKey","Difference","ExtractIf","Intersection","IntoIter","Iter","OccupiedEntry","Range","SymmetricDifference","Union","UnorderedKeyError","VacantEntry"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,2 @@
|
|||
<!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="Collection types."><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../" data-static-root-path="../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module collections</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../index.html">reexports</a>::<wbr><a href="../../../../index.html">client</a>::<wbr><a href="../../../index.html">backend</a>::<wbr><a href="../../index.html">smallvec</a>::<wbr><a href="../index.html">alloc</a></div><h1>Module <span>collections</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/lib.rs.html#220">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Collection types.</p>
|
||||
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="binary_heap/index.html" title="mod cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::binary_heap">binary_<wbr>heap</a></dt><dd>A priority queue implemented with a binary heap.</dd><dt><a class="mod" href="btree_map/index.html" title="mod cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_map">btree_<wbr>map</a></dt><dd>An ordered map based on a B-Tree.</dd><dt><a class="mod" href="btree_set/index.html" title="mod cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::btree_set">btree_<wbr>set</a></dt><dd>An ordered set based on a B-Tree.</dd><dt><a class="mod" href="linked_list/index.html" title="mod cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::linked_list">linked_<wbr>list</a></dt><dd>A doubly-linked list with owned nodes.</dd><dt><a class="mod" href="vec_deque/index.html" title="mod cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::vec_deque">vec_<wbr>deque</a></dt><dd>A double-ended queue (deque) implemented with a growable ring buffer.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BTreeMap.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::BTreeMap">BTree<wbr>Map</a></dt><dd>An ordered map based on a <a href="https://en.wikipedia.org/wiki/B-tree">B-Tree</a>.</dd><dt><a class="struct" href="struct.BTreeSet.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::BTreeSet">BTree<wbr>Set</a></dt><dd>An ordered set based on a B-Tree.</dd><dt><a class="struct" href="struct.BinaryHeap.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::BinaryHeap">Binary<wbr>Heap</a></dt><dd>A priority queue implemented with a binary heap.</dd><dt><a class="struct" href="struct.LinkedList.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::LinkedList">Linked<wbr>List</a></dt><dd>A doubly-linked list with owned nodes.</dd><dt><a class="struct" href="struct.TryReserveError.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::TryReserveError">TryReserve<wbr>Error</a></dt><dd>The error type for <code>try_reserve</code> methods.</dd><dt><a class="struct" href="struct.VecDeque.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::VecDeque">VecDeque</a></dt><dd>A double-ended queue implemented with a growable ring buffer.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.TryReserveErrorKind.html" title="enum cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::TryReserveErrorKind">TryReserve<wbr>Error<wbr>Kind</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>Details of the allocation that caused a <code>TryReserveError</code></dd></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!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="A doubly-linked list with owned nodes."><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::linked_list - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../../" data-static-root-path="../../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module linked_<wbr>list</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>collections</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../../index.html">reexports</a>::<wbr><a href="../../../../../index.html">client</a>::<wbr><a href="../../../../index.html">backend</a>::<wbr><a href="../../../index.html">smallvec</a>::<wbr><a href="../../index.html">alloc</a>::<wbr><a href="../index.html">collections</a></div><h1>Module <span>linked_list</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/collections/mod.rs.html#13">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A doubly-linked list with owned nodes.</p>
|
||||
<p>The <code>LinkedList</code> allows pushing and popping elements at either end
|
||||
in constant time.</p>
|
||||
<p>NOTE: It is almost always better to use <a href="../../vec/struct.Vec.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::vec::Vec"><code>Vec</code></a> or <a href="../struct.VecDeque.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::VecDeque"><code>VecDeque</code></a> because
|
||||
array-based containers are generally faster,
|
||||
more memory efficient, and make better use of CPU cache.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.ExtractIf.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::linked_list::ExtractIf">Extract<wbr>If</a></dt><dd>An iterator produced by calling <code>extract_if</code> on LinkedList.</dd><dt><a class="struct" href="struct.IntoIter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::linked_list::IntoIter">Into<wbr>Iter</a></dt><dd>An owning iterator over the elements of a <code>LinkedList</code>.</dd><dt><a class="struct" href="struct.Iter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::linked_list::Iter">Iter</a></dt><dd>An iterator over the elements of a <code>LinkedList</code>.</dd><dt><a class="struct" href="struct.IterMut.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::linked_list::IterMut">IterMut</a></dt><dd>A mutable iterator over the elements of a <code>LinkedList</code>.</dd><dt><a class="struct" href="struct.LinkedList.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::linked_list::LinkedList">Linked<wbr>List</a></dt><dd>A doubly-linked list with owned nodes.</dd><dt><a class="struct" href="struct.Cursor.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::linked_list::Cursor">Cursor</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A cursor over a <code>LinkedList</code>.</dd><dt><a class="struct" href="struct.CursorMut.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::linked_list::CursorMut">Cursor<wbr>Mut</a><wbr><span class="stab unstable" title="">Experimental</span></dt><dd>A cursor over a <code>LinkedList</code> with editing operations.</dd></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Cursor","CursorMut","ExtractIf","IntoIter","Iter","IterMut","LinkedList"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"enum":["TryReserveErrorKind"],"mod":["binary_heap","btree_map","btree_set","linked_list","vec_deque"],"struct":["BTreeMap","BTreeSet","BinaryHeap","LinkedList","TryReserveError","VecDeque"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,6 @@
|
|||
<!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="A double-ended queue (deque) implemented with a growable ring buffer."><title>cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::vec_deque - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../../../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../../../../../../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../../../../../../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../../../../../../../../" data-static-root-path="../../../../../../../../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../../../../../../../../static.files/storage-68b7e25d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../../../../../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../../../../../../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../../../../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../../../../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../../../../../../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module vec_<wbr>deque</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>cctk::<wbr>sctk::<wbr>reexports::<wbr>client::<wbr>backend::<wbr>smallvec::<wbr>alloc::<wbr>collections</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../../../../../../../../index.html">cosmic</a>::<wbr><a href="../../../../../../../../index.html">cctk</a>::<wbr><a href="../../../../../../../index.html">sctk</a>::<wbr><a href="../../../../../../index.html">reexports</a>::<wbr><a href="../../../../../index.html">client</a>::<wbr><a href="../../../../index.html">backend</a>::<wbr><a href="../../../index.html">smallvec</a>::<wbr><a href="../../index.html">alloc</a>::<wbr><a href="../index.html">collections</a></div><h1>Module <span>vec_deque</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/alloc/collections/mod.rs.html#15">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>wayland</code> and Linux</strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A double-ended queue (deque) implemented with a growable ring buffer.</p>
|
||||
<p>This queue has <em>O</em>(1) amortized inserts and removals from both ends of the
|
||||
container. It also has <em>O</em>(1) indexing like a vector. The contained elements
|
||||
are not required to be copyable, and the queue will be sendable if the
|
||||
contained type is sendable.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Drain.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::vec_deque::Drain">Drain</a></dt><dd>A draining iterator over the elements of a <code>VecDeque</code>.</dd><dt><a class="struct" href="struct.IntoIter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::vec_deque::IntoIter">Into<wbr>Iter</a></dt><dd>An owning iterator over the elements of a <code>VecDeque</code>.</dd><dt><a class="struct" href="struct.Iter.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::vec_deque::Iter">Iter</a></dt><dd>An iterator over the elements of a <code>VecDeque</code>.</dd><dt><a class="struct" href="struct.IterMut.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::vec_deque::IterMut">IterMut</a></dt><dd>A mutable iterator over the elements of a <code>VecDeque</code>.</dd><dt><a class="struct" href="struct.VecDeque.html" title="struct cosmic::cctk::sctk::reexports::client::backend::smallvec::alloc::collections::vec_deque::VecDeque">VecDeque</a></dt><dd>A double-ended queue implemented with a growable ring buffer.</dd></dl></section></div></main></body></html>
|
||||
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Drain","IntoIter","Iter","IterMut","VecDeque"]};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue