Files
greptimedb/common_base/bit_vec/prelude/trait.AsMutBits.html
2026-03-13 04:38:03 +00:00

35 lines
10 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="Mutable Bit View"><title>AsMutBits in common_base::bit_vec::prelude - 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="common_base" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (fa3155a64 2025-09-30)" data-channel="nightly" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-828709d0.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-ce535bd0.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="#">AsMutBits</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../common_base/index.html">common_<wbr>base</a><span class="version">1.0.0-rc.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">AsMut<wbr>Bits</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#mutable-bit-view" title="Mutable Bit View">Mutable Bit View</a><ul><li><a href="#usage" title="Usage">Usage</a></li><li><a href="#notes" title="Notes">Notes</a></li></ul></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.as_mut_bits" title="as_mut_bits">as_mut_bits</a></li><li><a href="#tymethod.try_as_mut_bits" title="try_as_mut_bits">try_as_mut_bits</a></li></ul><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 common_<wbr>base::<wbr>bit_<wbr>vec::<wbr>prelude</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">common_base</a>::<wbr><a href="../index.html">bit_vec</a>::<wbr><a href="index.html">prelude</a></div><h1>Trait <span class="trait">AsMut<wbr>Bits</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait AsMutBits&lt;T&gt;<div class="where">where
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div>{
// Required methods
fn <a href="#tymethod.as_mut_bits" class="fn">as_mut_bits</a>&lt;O&gt;(&amp;mut self) -&gt; &amp;mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a>&lt;T, O&gt; <a href="#" class="tooltip" data-notable-ty="&amp;mut BitSlice&lt;T, O&gt;"></a>
<span class="where">where O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a></span>;
<span class="item-spacer"></span> fn <a href="#tymethod.try_as_mut_bits" class="fn">try_as_mut_bits</a>&lt;O&gt;(
&amp;mut self,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&amp;mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a>&lt;T, O&gt;, BitSpanError&lt;T&gt;&gt;
<span class="where">where O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a></span>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="mutable-bit-view"><a class="doc-anchor" href="#mutable-bit-view">§</a>Mutable Bit View</h2>
<p>This trait is an analogue to the <a href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut"><code>AsMut</code></a> trait, in that it enables any type to
provide a view of a mutable bit-slice.</p>
<p>It does not require an <code>AsMut&lt;[T: BitStore]&gt;</code> implementation, but a blanket
implementation for all <code>AsMut&lt;[T: BitStore]&gt;</code> is provided. This allows you to
choose whether to implement only one of <code>AsMutBits&lt;T&gt;</code> or <code>AsMut&lt;[T]&gt;</code>, and gain
a bit-slice view through either choice.</p>
<h3 id="usage"><a class="doc-anchor" href="#usage">§</a>Usage</h3>
<p>The <code>.as_mut_bits&lt;_&gt;()</code> method has the same usage patterns as
<a href="trait._.html#tymethod.view_bits_mut" title="method common_base::bit_vec::prelude::_::view_bits_mut"><code>BitView::view_bits_mut</code></a>.</p>
<h3 id="notes"><a class="doc-anchor" href="#notes">§</a>Notes</h3>
<p>You are not <em>forbidden</em> from creating multiple views with different element
types to the same region, but doing so is likely to cause inconsistent and
surprising behavior.</p>
<p>Refrain from implementing this trait with more than one storage argument unless
you are sure that you can uphold the memory region requirements of all of them,
and are aware of the behavior conflicts that may arise.</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.as_mut_bits" class="method"><h4 class="code-header">fn <a href="#tymethod.as_mut_bits" class="fn">as_mut_bits</a>&lt;O&gt;(&amp;mut self) -&gt; &amp;mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a>&lt;T, O&gt; <a href="#" class="tooltip" data-notable-ty="&amp;mut BitSlice&lt;T, O&gt;"></a><div class="where">where
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section></summary><div class="docblock"><p>Views <code>self</code> as a mutable bit-slice region with the <code>O</code> ordering.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.try_as_mut_bits" class="method"><h4 class="code-header">fn <a href="#tymethod.try_as_mut_bits" class="fn">try_as_mut_bits</a>&lt;O&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&amp;mut <a class="struct" href="struct.BitSlice.html" title="struct common_base::bit_vec::prelude::BitSlice">BitSlice</a>&lt;T, O&gt;, BitSpanError&lt;T&gt;&gt;<div class="where">where
O: <a class="trait" href="trait.BitOrder.html" title="trait common_base::bit_vec::prelude::BitOrder">BitOrder</a>,</div></h4></section></summary><div class="docblock"><p>Attempts to view <code>self</code> as a mutable bit-slice region with the <code>O</code>
ordering.</p>
<p>This may return an error if <code>self</code> is too long to view as a bit-slice.</p>
</div></details></div><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/nightly/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-AsMutBits%3CT%3E-for-A" class="impl"><a href="#impl-AsMutBits%3CT%3E-for-A" class="anchor">§</a><h3 class="code-header">impl&lt;A, T&gt; <a class="trait" href="trait.AsMutBits.html" title="trait common_base::bit_vec::prelude::AsMutBits">AsMutBits</a>&lt;T&gt; for A<div class="where">where
A: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[T]</a>&gt;,
T: <a class="trait" href="trait.BitStore.html" title="trait common_base::bit_vec::prelude::BitStore">BitStore</a>,</div></h3></section></div><script src="../../../trait.impl/bitvec/view/trait.AsMutBits.js" async></script><script type="text/json" id="notable-traits-data">{"&mut BitSlice<T, O>":"<h3>Notable traits for <code>&amp;mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a>&lt;T, O&gt;</code></h3><pre><code><div class=\"where\">impl&lt;T, O&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &amp;mut <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a>&lt;T, O&gt;<div class=\"where\">where\n T: <a class=\"trait\" href=\"trait.BitStore.html\" title=\"trait common_base::bit_vec::prelude::BitStore\">BitStore</a>,\n O: <a class=\"trait\" href=\"trait.BitOrder.html\" title=\"trait common_base::bit_vec::prelude::BitOrder\">BitOrder</a>,\n <a class=\"struct\" href=\"struct.BitSlice.html\" title=\"struct common_base::bit_vec::prelude::BitSlice\">BitSlice</a>&lt;T, O&gt;: <a class=\"trait\" href=\"trait._.html\" title=\"trait common_base::bit_vec::prelude::_\">BitField</a>,</div></div>"}</script></section></div></main></body></html>