mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-21 07:15:32 +01:00
18 lines
No EOL
6.7 KiB
HTML
18 lines
No EOL
6.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>Storage in heapless::storage - 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="#">Storage</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="#">Storage</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>storage</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">storage</a></div><h1>Trait <span class="trait">Storage</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/storage.rs.html#86">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Storage: SealedStorage { }</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="enum.OwnedStorage.html" title="enum heapless::storage::OwnedStorage"><code>OwnedStorage</code></a>: stores the data in an array <code>[T; N]</code> whose size is known at compile time.</li>
|
||
<li><a href="enum.ViewStorage.html" title="enum heapless::storage::ViewStorage"><code>ViewStorage</code></a>: stores the data in an unsized <code>[T]</code>.</li>
|
||
</ul>
|
||
<p>This allows containers to be generic over either sized or unsized storage. For example,
|
||
the <a href="../vec/index.html" title="mod heapless::vec"><code>vec</code></a> module contains a <a href="../vec/struct.VecInner.html" title="struct heapless::vec::VecInner"><code>VecInner</code></a> struct
|
||
that’s generic on <a href="trait.Storage.html" title="trait heapless::storage::Storage"><code>Storage</code></a>, and two type aliases for convenience:</p>
|
||
<ul>
|
||
<li><a href="../vec/type.Vec.html" title="type heapless::vec::Vec"><code>Vec<T, N></code></a> = <code>VecInner<T, OwnedStorage<N>></code></li>
|
||
<li><a href="../vec/type.VecView.html" title="type heapless::vec::VecView"><code>VecView<T></code></a> = <code>VecInner<T, ViewStorage></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="../vec/struct.VecInner.html#method.as_view" title="method heapless::vec::VecInner::as_view"><code>.as_view()</code></a> or <a href="../vec/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-Storage-for-ViewStorage" class="impl"><a class="src rightside" href="../../src/heapless/storage.rs.html#154">Source</a><a href="#impl-Storage-for-ViewStorage" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Storage.html" title="trait heapless::storage::Storage">Storage</a> for <a class="enum" href="enum.ViewStorage.html" title="enum heapless::storage::ViewStorage">ViewStorage</a></h3></section><section id="impl-Storage-for-OwnedStorage%3CN%3E" class="impl"><a class="src rightside" href="../../src/heapless/storage.rs.html#91">Source</a><a href="#impl-Storage-for-OwnedStorage%3CN%3E" class="anchor">§</a><h3 class="code-header">impl<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.Storage.html" title="trait heapless::storage::Storage">Storage</a> for <a class="enum" href="enum.OwnedStorage.html" title="enum heapless::storage::OwnedStorage">OwnedStorage</a><N></h3></section></div><script src="../../trait.impl/heapless/storage/trait.Storage.js" async></script></section></div></main></body></html> |