mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-21 07:15:32 +01:00
20 lines
No EOL
7 KiB
HTML
20 lines
No EOL
7 KiB
HTML
<!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="Trait defining how data for a container is stored."><title>VecStorage in heapless::vec - 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"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="heapless" data-themes="" data-resource-suffix="" data-rustdoc-version="1.91.1 (ed61e7d7e 2025-11-07)" data-channel="1.91.1" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-c3e638e9.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-6dc2a7f3.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.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]--><rustdoc-topbar><h2><a href="#">VecStorage</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../heapless/index.html">heapless</a><span class="version">0.9.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">VecStorage</a></h2><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In heapless::<wbr>vec</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">heapless</a>::<wbr><a href="index.html">vec</a></div><h1>Trait <span class="trait">VecStorage</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="../../src/heapless/vec/mod.rs.html#63">Source</a> </span></div><pre class="rust item-decl"><code>pub trait VecStorage<T>: VecSealedStorage<T> { }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait defining how data for a container is stored.</p>
|
||
<p>There’s two implementations available:</p>
|
||
<ul>
|
||
<li><a href="type.OwnedVecStorage.html" title="type heapless::vec::OwnedVecStorage"><code>OwnedVecStorage</code></a>: stores the data in an array <code>[T; N]</code> whose size is known at compile
|
||
time.</li>
|
||
<li><a href="type.ViewVecStorage.html" title="type heapless::vec::ViewVecStorage"><code>ViewVecStorage</code></a>: stores the data in an unsized <code>[T]</code>.</li>
|
||
</ul>
|
||
<p>This allows <a href="type.Vec.html" title="type heapless::vec::Vec"><code>Vec</code></a> to be generic over either sized or unsized storage. The <a href="index.html" title="mod heapless::vec"><code>vec</code></a>
|
||
module contains a <a href="struct.VecInner.html" title="struct heapless::vec::VecInner"><code>VecInner</code></a> struct that’s generic on <a href="trait.VecStorage.html" title="trait heapless::vec::VecStorage"><code>VecStorage</code></a>,
|
||
and two type aliases for convenience:</p>
|
||
<ul>
|
||
<li><a href="type.Vec.html" title="type heapless::vec::Vec"><code>Vec<T, N></code></a> = <code>VecInner<T, OwnedStorage<T, N>></code></li>
|
||
<li><a href="type.VecView.html" title="type heapless::vec::VecView"><code>VecView<T></code></a> = <code>VecInner<T, ViewStorage<T>></code></li>
|
||
</ul>
|
||
<p><code>Vec</code> can be unsized into <code>VecView</code>, either by unsizing coercions such as <code>&mut Vec -> &mut VecView</code> or <code>Box<Vec> -> Box<VecView></code>, or explicitly with
|
||
<a href="struct.VecInner.html#method.as_view" title="method heapless::vec::VecInner::as_view"><code>.as_view()</code></a> or
|
||
<a href="struct.VecInner.html#method.as_mut_view" title="method heapless::vec::VecInner::as_mut_view"><code>.as_mut_view()</code></a>.</p>
|
||
<p>This trait is sealed, so you cannot implement it for your own types. You can only use
|
||
the implementations provided by this crate.</p>
|
||
</div></details><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.91.1/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-VecStorage%3CT%3E-for-VecStorageInner%3C%5BMaybeUninit%3CT%3E%5D%3E" class="impl"><a class="src rightside" href="../../src/heapless/vec/mod.rs.html#214">Source</a><a href="#impl-VecStorage%3CT%3E-for-VecStorageInner%3C%5BMaybeUninit%3CT%3E%5D%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.VecStorage.html" title="trait heapless::vec::VecStorage">VecStorage</a><T> for <a class="type" href="type.ViewVecStorage.html" title="type heapless::vec::ViewVecStorage">ViewVecStorage</a><T></h3></section><section id="impl-VecStorage%3CT%3E-for-VecStorageInner%3C%5BMaybeUninit%3CT%3E;+N%5D%3E" class="impl"><a class="src rightside" href="../../src/heapless/vec/mod.rs.html#162">Source</a><a href="#impl-VecStorage%3CT%3E-for-VecStorageInner%3C%5BMaybeUninit%3CT%3E;+N%5D%3E" class="anchor">§</a><h3 class="code-header">impl<T, const N: <a class="primitive" href="https://doc.rust-lang.org/1.91.1/core/primitive.usize.html">usize</a>> <a class="trait" href="trait.VecStorage.html" title="trait heapless::vec::VecStorage">VecStorage</a><T> for <a class="type" href="type.OwnedVecStorage.html" title="type heapless::vec::OwnedVecStorage">OwnedVecStorage</a><T, N></h3></section></div><script src="../../trait.impl/heapless/vec/storage/trait.VecStorage.js" async></script></section></div></main></body></html> |