284 lines
108 KiB
HTML
284 lines
108 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="A zero-copy “slice”, i.e. the zero-copy version of `[T]`."><title>ZeroSlice in zerovec - 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-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="zerovec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.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-a410ff4d.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 struct"><!--[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="#">ZeroSlice</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../zerovec/index.html">zerovec</a><span class="version">0.11.5</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Zero<wbr>Slice</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="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.as_bytes" title="as_bytes">as_bytes</a></li><li><a href="#method.as_ule_slice" title="as_ule_slice">as_ule_slice</a></li><li><a href="#method.as_zerovec" title="as_zerovec">as_zerovec</a></li><li><a href="#method.binary_search" title="binary_search">binary_search</a></li><li><a href="#method.binary_search_by" title="binary_search_by">binary_search_by</a></li><li><a href="#method.cast" title="cast">cast</a></li><li><a href="#method.first" title="first">first</a></li><li><a href="#method.from_bytes_unchecked" title="from_bytes_unchecked">from_bytes_unchecked</a></li><li><a href="#method.from_ule_slice" title="from_ule_slice">from_ule_slice</a></li><li><a href="#method.get" title="get">get</a></li><li><a href="#method.get_as_array" title="get_as_array">get_as_array</a></li><li><a href="#method.get_subslice" title="get_subslice">get_subslice</a></li><li><a href="#method.get_ule_ref" title="get_ule_ref">get_ule_ref</a></li><li><a href="#method.is_empty" title="is_empty">is_empty</a></li><li><a href="#method.iter" title="iter">iter</a></li><li><a href="#method.last" title="last">last</a></li><li><a href="#method.len" title="len">len</a></li><li><a href="#method.new_empty" title="new_empty">new_empty</a></li><li><a href="#method.parse_bytes" title="parse_bytes">parse_bytes</a></li><li><a href="#method.split_first" title="split_first">split_first</a></li><li><a href="#method.try_as_converted" title="try_as_converted">try_as_converted</a></li><li><a href="#method.try_from_bytes" title="try_from_bytes">try_from_bytes</a></li><li><a href="#method.try_from_bytes-1" title="try_from_bytes">try_from_bytes</a></li><li><a href="#method.try_from_bytes-2" title="try_from_bytes">try_from_bytes</a></li><li><a href="#method.try_from_bytes-3" title="try_from_bytes">try_from_bytes</a></li><li><a href="#method.try_from_bytes-4" title="try_from_bytes">try_from_bytes</a></li><li><a href="#method.try_from_bytes-5" title="try_from_bytes">try_from_bytes</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-AsRef%3CZeroSlice%3CT%3E%3E-for-%26%5B%3CT+as+AsULE%3E::ULE%5D" title="AsRef<ZeroSlice<T>>">AsRef<ZeroSlice<T>></a></li><li><a href="#impl-AsRef%3CZeroSlice%3CT%3E%3E-for-ZeroVec%3C'a,+T%3E" title="AsRef<ZeroSlice<T>>">AsRef<ZeroSlice<T>></a></li><li><a href="#impl-Debug-for-ZeroSlice%3CT%3E" title="Debug">Debug</a></li><li><a href="#impl-Default-for-%26ZeroSlice%3CT%3E" title="Default">Default</a></li><li><a href="#impl-EncodeAsVarULE%3CZeroSlice%3CT%3E%3E-for-%26%5BT%5D" title="EncodeAsVarULE<ZeroSlice<T>>">EncodeAsVarULE<ZeroSlice<T>></a></li><li><a href="#impl-EncodeAsVarULE%3CZeroSlice%3CT%3E%3E-for-ZeroVec%3C'_,+T%3E" title="EncodeAsVarULE<ZeroSlice<T>>">EncodeAsVarULE<ZeroSlice<T>></a></li><li><a href="#impl-Eq-for-ZeroSlice%3CT%3E" title="Eq">Eq</a></li><li><a href="#impl-Ord-for-ZeroSlice%3CT%3E" title="Ord">Ord</a></li><li><a href="#impl-PartialEq-for-ZeroSlice%3CT%3E" title="PartialEq">PartialEq</a></li><li><a href="#impl-PartialEq%3CZeroSlice%3CT%3E%3E-for-ZeroVec%3C'a,+T%3E" title="PartialEq<ZeroSlice<T>>">PartialEq<ZeroSlice<T>></a></li><li><a href="#impl-PartialEq%3CZeroVec%3C'a,+T%3E%3E-for-ZeroSlice%3CT%3E" title="PartialEq<ZeroVec<'a, T>>">PartialEq<ZeroVec<'a, T>></a></li><li><a href="#impl-PartialEq%3C%5BT%5D%3E-for-ZeroSlice%3CT%3E" title="PartialEq<[T]>">PartialEq<[T]></a></li><li><a href="#impl-PartialOrd-for-ZeroSlice%3CT%3E" title="PartialOrd">PartialOrd</a></li><li><a href="#impl-VarULE-for-ZeroSlice%3CT%3E" title="VarULE">VarULE</a></li><li><a href="#impl-ZeroFrom%3C'zf,+ZeroSlice%3CT%3E%3E-for-%26ZeroSlice%3CT%3E" title="ZeroFrom<'zf, ZeroSlice<T>>">ZeroFrom<'zf, ZeroSlice<T>></a></li><li><a href="#impl-ZeroFrom%3C'zf,+ZeroSlice%3CT%3E%3E-for-ZeroVec%3C'zf,+T%3E" title="ZeroFrom<'zf, ZeroSlice<T>>">ZeroFrom<'zf, ZeroSlice<T>></a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Sized-for-ZeroSlice%3CT%3E" title="!Sized">!Sized</a></li><li><a href="#impl-Freeze-for-ZeroSlice%3CT%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-ZeroSlice%3CT%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-ZeroSlice%3CT%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-ZeroSlice%3CT%3E" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-ZeroSlice%3CT%3E" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-ZeroSlice%3CT%3E" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-EncodeAsVarULE%3CT%3E-for-T" title="EncodeAsVarULE<T>">EncodeAsVarULE<T></a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate zerovec</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">zerovec</a></div><h1>Struct <span class="struct">Zero<wbr>Slice</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/zerovec/zerovec/slice.rs.html#36">Source</a> </span></div><pre class="rust item-decl"><code>pub struct ZeroSlice<T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>>(<span class="comment">/* private fields */</span>);</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A zero-copy “slice”, i.e. the zero-copy version of <code>[T]</code>.</p>
|
||
<p>This behaves
|
||
similarly to <a href="struct.ZeroVec.html" title="struct zerovec::ZeroVec"><code>ZeroVec<T></code></a>, however <a href="struct.ZeroVec.html" title="struct zerovec::ZeroVec"><code>ZeroVec<T></code></a> is allowed to contain
|
||
owned data and as such is ideal for deserialization since most human readable
|
||
serialization formats cannot unconditionally deserialize zero-copy.</p>
|
||
<p>This type can be used inside <a href="struct.VarZeroVec.html" title="struct zerovec::VarZeroVec"><code>VarZeroVec<T></code></a> and <a href="crate::ZeroMap"><code>ZeroMap</code></a>:
|
||
This essentially allows for the construction of zero-copy types isomorphic to <code>Vec<Vec<T>></code> by instead
|
||
using <code>VarZeroVec<ZeroSlice<T>></code>. See the <a href="struct.VarZeroVec.html" title="struct zerovec::VarZeroVec"><code>VarZeroVec</code></a> docs for an example.</p>
|
||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||
<p>Const-construct a ZeroSlice of u16:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ule::AsULE;
|
||
<span class="kw">use </span>zerovec::ZeroSlice;
|
||
|
||
<span class="kw">const </span>DATA: <span class="kw-2">&</span>ZeroSlice<u16> =
|
||
ZeroSlice::<u16>::from_ule_slice(<span class="kw-2">&</span><u16 <span class="kw">as </span>AsULE>::ULE::from_array([
|
||
<span class="number">211</span>, <span class="number">281</span>, <span class="number">421</span>, <span class="number">32973</span>,
|
||
]));
|
||
|
||
<span class="macro">assert_eq!</span>(DATA.get(<span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="number">281</span>));</code></pre></div></div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#38-169">Source</a><a href="#impl-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new_empty" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#43-45">Source</a><h4 class="code-header">pub const fn <a href="#method.new_empty" class="fn">new_empty</a>() -> &'static Self</h4></section></summary><div class="docblock"><p>Returns an empty slice.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_zerovec" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#52-54">Source</a><h4 class="code-header">pub const fn <a href="#method.as_zerovec" class="fn">as_zerovec</a>(&self) -> <a class="struct" href="struct.ZeroVec.html" title="struct zerovec::ZeroVec">ZeroVec</a><'_, T></h4></section></summary><div class="docblock"><p>Get this <a href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice"><code>ZeroSlice</code></a> as a borrowed <a href="struct.ZeroVec.html" title="struct zerovec::ZeroVec"><code>ZeroVec</code></a></p>
|
||
<p><a href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice"><code>ZeroSlice</code></a> does not have most of the methods that <a href="struct.ZeroVec.html" title="struct zerovec::ZeroVec"><code>ZeroVec</code></a> does,
|
||
so it is recommended to convert it to a <a href="struct.ZeroVec.html" title="struct zerovec::ZeroVec"><code>ZeroVec</code></a> before doing anything.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_bytes" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#58-60">Source</a><h4 class="code-header">pub fn <a href="#method.parse_bytes" class="fn">parse_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&Self, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class="docblock"><p>Attempt to construct a <code>&ZeroSlice<T></code> from a byte slice, returning an error
|
||
if it’s not a valid byte sequence</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_bytes_unchecked" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#67-73">Source</a><h4 class="code-header">pub const unsafe fn <a href="#method.from_bytes_unchecked" class="fn">from_bytes_unchecked</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> &Self</h4></section></summary><div class="docblock"><p>Uses a <code>&[u8]</code> buffer as a <code>ZeroVec<T></code> without any verification.</p>
|
||
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
|
||
<p><code>bytes</code> need to be an output from <a href="struct.ZeroSlice.html#method.as_bytes" title="method zerovec::ZeroSlice::as_bytes"><code>ZeroSlice::as_bytes()</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_ule_slice" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#82-86">Source</a><h4 class="code-header">pub const fn <a href="#method.from_ule_slice" class="fn">from_ule_slice</a>(slice: &[T::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>]) -> &Self</h4></section></summary><div class="docblock"><p>Construct a <code>&ZeroSlice<T></code> from a slice of ULEs.</p>
|
||
<p>This function can be used for constructing ZeroVecs in a const context, avoiding
|
||
parsing checks.</p>
|
||
<p>See <a href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice"><code>ZeroSlice</code></a> for an example.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_bytes" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#117-119">Source</a><h4 class="code-header">pub fn <a href="#method.as_bytes" class="fn">as_bytes</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns this slice as its underlying <code>&[u8]</code> byte buffer representation.</p>
|
||
<p>Useful for serialization.</p>
|
||
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="comment">// The little-endian bytes correspond to the numbers on the following line.
|
||
</span><span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>nums: <span class="kw-2">&</span>[u16] = <span class="kw-2">&</span>[<span class="number">211</span>, <span class="number">281</span>, <span class="number">421</span>, <span class="number">32973</span>];
|
||
|
||
<span class="kw">let </span>zerovec = ZeroVec::alloc_from_slice(nums);
|
||
|
||
<span class="macro">assert_eq!</span>(bytes, zerovec.as_bytes());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.as_ule_slice" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#123-125">Source</a><h4 class="code-header">pub const fn <a href="#method.as_ule_slice" class="fn">as_ule_slice</a>(&self) -> &[T::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>]</h4></section></summary><div class="docblock"><p>Dereferences this slice as <code>&[T::ULE]</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.len" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#146-148">Source</a><h4 class="code-header">pub const fn <a href="#method.len" class="fn">len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the number of elements in this slice.</p>
|
||
<h5 id="example-1"><a class="doc-anchor" href="#example-1">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ule::AsULE;
|
||
<span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="number">4</span>, zerovec.len());
|
||
<span class="macro">assert_eq!</span>(
|
||
bytes.len(),
|
||
zerovec.len() * std::mem::size_of::<<u16 <span class="kw">as </span>AsULE>::ULE>()
|
||
);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#166-168">Source</a><h4 class="code-header">pub const fn <a href="#method.is_empty" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns whether this slice is empty.</p>
|
||
<h5 id="example-2"><a class="doc-anchor" href="#example-2">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
<span class="macro">assert!</span>(!zerovec.is_empty());
|
||
|
||
<span class="kw">let </span>emptyvec: ZeroVec<u16> = ZeroVec::parse_bytes(<span class="kw-2">&</span>[]).expect(<span class="string">"infallible"</span>);
|
||
<span class="macro">assert!</span>(emptyvec.is_empty());</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3CT%3E-1" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#171-404">Source</a><a href="#impl-ZeroSlice%3CT%3E-1" class="anchor">§</a><h3 class="code-header">impl<T> <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.get" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#190-195">Source</a><h4 class="code-header">pub fn <a href="#method.get" class="fn">get</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T></h4></section></summary><div class="docblock"><p>Gets the element at the specified index. Returns <code>None</code> if out of range.</p>
|
||
<h5 id="example-3"><a class="doc-anchor" href="#example-3">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(zerovec.get(<span class="number">2</span>), <span class="prelude-val">Some</span>(<span class="number">421</span>));
|
||
<span class="macro">assert_eq!</span>(zerovec.get(<span class="number">4</span>), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_as_array" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#213-216">Source</a><h4 class="code-header">pub fn <a href="#method.get_as_array" class="fn">get_as_array</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">[T; N]</a>></h4></section></summary><div class="docblock"><p>Gets the entire slice as an array of length <code>N</code>. Returns <code>None</code> if the slice
|
||
does not have exactly <code>N</code> elements.</p>
|
||
<h5 id="example-4"><a class="doc-anchor" href="#example-4">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
<span class="kw">let </span>array: [u16; <span class="number">4</span>] =
|
||
zerovec.get_as_array().expect(<span class="string">"should be 4 items in array"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(array[<span class="number">2</span>], <span class="number">421</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_subslice" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#237-239">Source</a><h4 class="code-header">pub fn <a href="#method.get_subslice" class="fn">get_subslice</a>(&self, range: <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>></h4></section></summary><div class="docblock"><p>Gets a subslice of elements within a certain range. Returns <code>None</code> if the range
|
||
is out of bounds of this <code>ZeroSlice</code>.</p>
|
||
<h5 id="example-5"><a class="doc-anchor" href="#example-5">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(
|
||
zerovec.get_subslice(<span class="number">1</span>..<span class="number">3</span>),
|
||
<span class="prelude-val">Some</span>(<span class="kw-2">&*</span>ZeroVec::from_slice_or_alloc(<span class="kw-2">&</span>[<span class="number">0x0119</span>, <span class="number">0x01A5</span>]))
|
||
);
|
||
<span class="macro">assert_eq!</span>(zerovec.get_subslice(<span class="number">3</span>..<span class="number">5</span>), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_ule_ref" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#245-247">Source</a><h4 class="code-header">pub fn <a href="#method.get_ule_ref" class="fn">get_ule_ref</a>(&self, index: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&T::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>></h4></section></summary><div class="docblock"><p>Get a borrowed reference to the underlying ULE type at a specified index.</p>
|
||
<p>Prefer <a href="struct.ZeroSlice.html#method.get" title="method zerovec::ZeroSlice::get"><code>Self::get()</code></a> over this method where possible since working
|
||
directly with <code>ULE</code> types is less ergonomic</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.cast" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#274-279">Source</a><h4 class="code-header">pub const fn <a href="#method.cast" class="fn">cast</a><P>(&self) -> &<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><P><div class="where">where
|
||
P: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a><ULE = T::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>>,</div></h4></section></summary><div class="docblock"><p>Casts a <code>ZeroSlice<T></code> to a compatible <code>ZeroSlice<P></code>.</p>
|
||
<p><code>T</code> and <code>P</code> are compatible if they have the same <code>ULE</code> representation.</p>
|
||
<p>If the <code>ULE</code>s of <code>T</code> and <code>P</code> are different, use <a href="struct.ZeroSlice.html#method.try_as_converted" title="method zerovec::ZeroSlice::try_as_converted"><code>Self::try_as_converted()</code></a>.</p>
|
||
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroSlice;
|
||
|
||
<span class="kw">const </span>BYTES: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">const </span>ZS_U16: <span class="kw-2">&</span>ZeroSlice<u16> = {
|
||
<span class="kw">match </span>ZeroSlice::<u16>::try_from_bytes(BYTES) {
|
||
<span class="prelude-val">Ok</span>(s) => s,
|
||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="macro">unreachable!</span>(),
|
||
}
|
||
};
|
||
|
||
<span class="kw">let </span>zs_i16: <span class="kw-2">&</span>ZeroSlice<i16> = ZS_U16.cast();
|
||
|
||
<span class="macro">assert_eq!</span>(ZS_U16.get(<span class="number">3</span>), <span class="prelude-val">Some</span>(<span class="number">32973</span>));
|
||
<span class="macro">assert_eq!</span>(zs_i16.get(<span class="number">3</span>), <span class="prelude-val">Some</span>(-<span class="number">32563</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.try_as_converted" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#308-311">Source</a><h4 class="code-header">pub fn <a href="#method.try_as_converted" class="fn">try_as_converted</a><P: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><P>, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class="docblock"><p>Converts a <code>&ZeroSlice<T></code> into a <code>&ZeroSlice<P></code>.</p>
|
||
<p>The resulting slice will have the same length as the original slice
|
||
if and only if <code>T::ULE</code> and <code>P::ULE</code> are the same size.</p>
|
||
<p>If <code>T</code> and <code>P</code> have the exact same <code>ULE</code>, use <a href="struct.ZeroSlice.html#method.cast" title="method zerovec::ZeroSlice::cast"><code>Self::cast()</code></a>.</p>
|
||
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroSlice;
|
||
|
||
<span class="kw">const </span>BYTES: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0x7F</span>, <span class="number">0xF3</span>, <span class="number">0x01</span>, <span class="number">0x00</span>, <span class="number">0x49</span>, <span class="number">0xF6</span>, <span class="number">0x01</span>, <span class="number">0x00</span>];
|
||
<span class="kw">const </span>ZS_U32: <span class="kw-2">&</span>ZeroSlice<u32> = {
|
||
<span class="kw">match </span>ZeroSlice::<u32>::try_from_bytes(BYTES) {
|
||
<span class="prelude-val">Ok</span>(s) => s,
|
||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="macro">unreachable!</span>(),
|
||
}
|
||
};
|
||
|
||
<span class="kw">let </span>zs_u8_4: <span class="kw-2">&</span>ZeroSlice<[u8; <span class="number">4</span>]> =
|
||
ZS_U32.try_as_converted().expect(<span class="string">"valid code points"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(ZS_U32.get(<span class="number">0</span>), <span class="prelude-val">Some</span>(<span class="number">127871</span>));
|
||
<span class="macro">assert_eq!</span>(zs_u8_4.get(<span class="number">0</span>), <span class="prelude-val">Some</span>([<span class="number">0x7F</span>, <span class="number">0xF3</span>, <span class="number">0x01</span>, <span class="number">0x00</span>]));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.first" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#327-329">Source</a><h4 class="code-header">pub fn <a href="#method.first" class="fn">first</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T></h4></section></summary><div class="docblock"><p>Gets the first element. Returns <code>None</code> if empty.</p>
|
||
<h5 id="example-6"><a class="doc-anchor" href="#example-6">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(zerovec.first(), <span class="prelude-val">Some</span>(<span class="number">211</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.last" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#345-347">Source</a><h4 class="code-header">pub fn <a href="#method.last" class="fn">last</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T></h4></section></summary><div class="docblock"><p>Gets the last element. Returns <code>None</code> if empty.</p>
|
||
<h5 id="example-7"><a class="doc-anchor" href="#example-7">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(zerovec.last(), <span class="prelude-val">Some</span>(<span class="number">32973</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.iter" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#368-370">Source</a><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a><'a>(&'a self) -> <a class="struct" href="vecs/struct.ZeroSliceIter.html" title="struct zerovec::vecs::ZeroSliceIter">ZeroSliceIter</a><'a, T> <a href="#" class="tooltip" data-notable-ty="ZeroSliceIter<'a, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Gets an iterator over the elements.</p>
|
||
<h5 id="example-8"><a class="doc-anchor" href="#example-8">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
<span class="kw">let </span><span class="kw-2">mut </span>it = zerovec.iter();
|
||
|
||
<span class="macro">assert_eq!</span>(it.next(), <span class="prelude-val">Some</span>(<span class="number">211</span>));
|
||
<span class="macro">assert_eq!</span>(it.next(), <span class="prelude-val">Some</span>(<span class="number">281</span>));
|
||
<span class="macro">assert_eq!</span>(it.next(), <span class="prelude-val">Some</span>(<span class="number">421</span>));
|
||
<span class="macro">assert_eq!</span>(it.next(), <span class="prelude-val">Some</span>(<span class="number">32973</span>));
|
||
<span class="macro">assert_eq!</span>(it.next(), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.split_first" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#393-403">Source</a><h4 class="code-header">pub fn <a href="#method.split_first" class="fn">split_first</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(T, &<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>)></h4></section></summary><div class="docblock"><p>Returns a tuple with the first element and a subslice of the remaining elements.</p>
|
||
<h5 id="example-9"><a class="doc-anchor" href="#example-9">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ule::AsULE;
|
||
<span class="kw">use </span>zerovec::ZeroSlice;
|
||
|
||
<span class="kw">const </span>DATA: <span class="kw-2">&</span>ZeroSlice<u16> =
|
||
ZeroSlice::<u16>::from_ule_slice(<span class="kw-2">&</span><u16 <span class="kw">as </span>AsULE>::ULE::from_array([
|
||
<span class="number">211</span>, <span class="number">281</span>, <span class="number">421</span>, <span class="number">32973</span>,
|
||
]));
|
||
<span class="kw">const </span>EXPECTED_VALUE: (u16, <span class="kw-2">&</span>ZeroSlice<u16>) = (
|
||
<span class="number">211</span>,
|
||
ZeroSlice::<u16>::from_ule_slice(<span class="kw-2">&</span><u16 <span class="kw">as </span>AsULE>::ULE::from_array([
|
||
<span class="number">281</span>, <span class="number">421</span>, <span class="number">32973</span>,
|
||
])),
|
||
);
|
||
<span class="macro">assert_eq!</span>(EXPECTED_VALUE, DATA.split_first().unwrap());</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3CT%3E-2" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#433-459">Source</a><a href="#impl-ZeroSlice%3CT%3E-2" class="anchor">§</a><h3 class="code-header">impl<T> <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.binary_search" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#455-458">Source</a><h4 class="code-header">pub fn <a href="#method.binary_search" class="fn">binary_search</a>(&self, x: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Binary searches a sorted <code>ZeroVec<T></code> for the given element. For more information, see
|
||
the primitive function <a href="https://doc.rust-lang.org/std/primitive.slice.html#method.binary_search"><code>binary_search</code></a>.</p>
|
||
<h5 id="example-10"><a class="doc-anchor" href="#example-10">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(zerovec.binary_search(<span class="kw-2">&</span><span class="number">281</span>), <span class="prelude-val">Ok</span>(<span class="number">1</span>));
|
||
<span class="macro">assert_eq!</span>(zerovec.binary_search(<span class="kw-2">&</span><span class="number">282</span>), <span class="prelude-val">Err</span>(<span class="number">2</span>));</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3CT%3E-3" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#461-490">Source</a><a href="#impl-ZeroSlice%3CT%3E-3" class="anchor">§</a><h3 class="code-header">impl<T> <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.binary_search_by" class="method"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#483-489">Source</a><h4 class="code-header">pub fn <a href="#method.binary_search_by" class="fn">binary_search_by</a>(
|
||
&self,
|
||
predicate: impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Binary searches a sorted <code>ZeroVec<T></code> based on a given predicate. For more information, see
|
||
the primitive function <a href="https://doc.rust-lang.org/std/primitive.slice.html#method.binary_search_by"><code>binary_search_by</code></a>.</p>
|
||
<h5 id="example-11"><a class="doc-anchor" href="#example-11">§</a>Example</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerovec::ZeroVec;
|
||
|
||
<span class="kw">let </span>bytes: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[<span class="number">0xD3</span>, <span class="number">0x00</span>, <span class="number">0x19</span>, <span class="number">0x01</span>, <span class="number">0xA5</span>, <span class="number">0x01</span>, <span class="number">0xCD</span>, <span class="number">0x80</span>];
|
||
<span class="kw">let </span>zerovec: ZeroVec<u16> =
|
||
ZeroVec::parse_bytes(bytes).expect(<span class="string">"infallible"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(zerovec.binary_search_by(|x| x.cmp(<span class="kw-2">&</span><span class="number">281</span>)), <span class="prelude-val">Ok</span>(<span class="number">1</span>));
|
||
<span class="macro">assert_eq!</span>(zerovec.binary_search_by(|x| x.cmp(<span class="kw-2">&</span><span class="number">282</span>)), <span class="prelude-val">Err</span>(<span class="number">2</span>));</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3Cu8%3E" class="impl"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#171">Source</a><a href="#impl-ZeroSlice%3Cu8%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.try_from_bytes" class="method"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#171">Source</a><h4 class="code-header">pub const fn <a href="#method.try_from_bytes" class="fn">try_from_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&Self, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class="docblock"><p>This function can be used for constructing ZeroVecs in a const context, avoiding
|
||
parsing checks.</p>
|
||
<p>This cannot be generic over T because of current limitations in <code>const</code>, but if
|
||
this method is needed in a non-const context, check out <a href="struct.ZeroSlice.html#method.parse_bytes" title="associated function zerovec::ZeroSlice::parse_bytes"><code>ZeroSlice::parse_bytes()</code></a>
|
||
instead.</p>
|
||
<p>See <a href="struct.ZeroSlice.html#method.cast" title="method zerovec::ZeroSlice::cast"><code>ZeroSlice::cast()</code></a> for an example.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3Cu16%3E" class="impl"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#172">Source</a><a href="#impl-ZeroSlice%3Cu16%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u16.html">u16</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.try_from_bytes-1" class="method"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#172">Source</a><h4 class="code-header">pub const fn <a href="#method.try_from_bytes-1" class="fn">try_from_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&Self, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class="docblock"><p>This function can be used for constructing ZeroVecs in a const context, avoiding
|
||
parsing checks.</p>
|
||
<p>This cannot be generic over T because of current limitations in <code>const</code>, but if
|
||
this method is needed in a non-const context, check out <a href="struct.ZeroSlice.html#method.parse_bytes" title="associated function zerovec::ZeroSlice::parse_bytes"><code>ZeroSlice::parse_bytes()</code></a>
|
||
instead.</p>
|
||
<p>See <a href="struct.ZeroSlice.html#method.cast" title="method zerovec::ZeroSlice::cast"><code>ZeroSlice::cast()</code></a> for an example.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3Cu32%3E" class="impl"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#173">Source</a><a href="#impl-ZeroSlice%3Cu32%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u32.html">u32</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.try_from_bytes-2" class="method"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#173">Source</a><h4 class="code-header">pub const fn <a href="#method.try_from_bytes-2" class="fn">try_from_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&Self, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class="docblock"><p>This function can be used for constructing ZeroVecs in a const context, avoiding
|
||
parsing checks.</p>
|
||
<p>This cannot be generic over T because of current limitations in <code>const</code>, but if
|
||
this method is needed in a non-const context, check out <a href="struct.ZeroSlice.html#method.parse_bytes" title="associated function zerovec::ZeroSlice::parse_bytes"><code>ZeroSlice::parse_bytes()</code></a>
|
||
instead.</p>
|
||
<p>See <a href="struct.ZeroSlice.html#method.cast" title="method zerovec::ZeroSlice::cast"><code>ZeroSlice::cast()</code></a> for an example.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3Cu64%3E" class="impl"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#174">Source</a><a href="#impl-ZeroSlice%3Cu64%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.try_from_bytes-3" class="method"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#174">Source</a><h4 class="code-header">pub const fn <a href="#method.try_from_bytes-3" class="fn">try_from_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&Self, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class="docblock"><p>This function can be used for constructing ZeroVecs in a const context, avoiding
|
||
parsing checks.</p>
|
||
<p>This cannot be generic over T because of current limitations in <code>const</code>, but if
|
||
this method is needed in a non-const context, check out <a href="struct.ZeroSlice.html#method.parse_bytes" title="associated function zerovec::ZeroSlice::parse_bytes"><code>ZeroSlice::parse_bytes()</code></a>
|
||
instead.</p>
|
||
<p>See <a href="struct.ZeroSlice.html#method.cast" title="method zerovec::ZeroSlice::cast"><code>ZeroSlice::cast()</code></a> for an example.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3Cu128%3E" class="impl"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#175">Source</a><a href="#impl-ZeroSlice%3Cu128%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u128.html">u128</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.try_from_bytes-4" class="method"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#175">Source</a><h4 class="code-header">pub const fn <a href="#method.try_from_bytes-4" class="fn">try_from_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&Self, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class="docblock"><p>This function can be used for constructing ZeroVecs in a const context, avoiding
|
||
parsing checks.</p>
|
||
<p>This cannot be generic over T because of current limitations in <code>const</code>, but if
|
||
this method is needed in a non-const context, check out <a href="struct.ZeroSlice.html#method.parse_bytes" title="associated function zerovec::ZeroSlice::parse_bytes"><code>ZeroSlice::parse_bytes()</code></a>
|
||
instead.</p>
|
||
<p>See <a href="struct.ZeroSlice.html#method.cast" title="method zerovec::ZeroSlice::cast"><code>ZeroSlice::cast()</code></a> for an example.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroSlice%3Cbool%3E" class="impl"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#180">Source</a><a href="#impl-ZeroSlice%3Cbool%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.try_from_bytes-5" class="method"><a class="src rightside" href="../src/zerovec/ule/plain.rs.html#180">Source</a><h4 class="code-header">pub const fn <a href="#method.try_from_bytes-5" class="fn">try_from_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&Self, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class="docblock"><p>This function can be used for constructing ZeroVecs in a const context, avoiding
|
||
parsing checks.</p>
|
||
<p>This cannot be generic over T because of current limitations in <code>const</code>, but if
|
||
this method is needed in a non-const context, check out <a href="struct.ZeroSlice.html#method.parse_bytes" title="associated function zerovec::ZeroSlice::parse_bytes"><code>ZeroSlice::parse_bytes()</code></a>
|
||
instead.</p>
|
||
<p>See <a href="struct.ZeroSlice.html#method.cast" title="method zerovec::ZeroSlice::cast"><code>ZeroSlice::cast()</code></a> for an example.</p>
|
||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CZeroSlice%3CT%3E%3E-for-%26%5B%3CT+as+AsULE%3E::ULE%5D" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#583-587">Source</a><a href="#impl-AsRef%3CZeroSlice%3CT%3E%3E-for-%26%5B%3CT+as+AsULE%3E::ULE%5D" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>> for &[T::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#584-586">Source</a><a href="#method.as_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> &<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CZeroSlice%3CT%3E%3E-for-ZeroVec%3C'a,+T%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/mod.rs.html#216-220">Source</a><a href="#impl-AsRef%3CZeroSlice%3CT%3E%3E-for-ZeroVec%3C'a,+T%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>> for <a class="struct" href="struct.ZeroVec.html" title="struct zerovec::ZeroVec">ZeroVec</a><'a, T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref-1" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/mod.rs.html#217-219">Source</a><a href="#method.as_ref-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> &<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#555-562">Source</a><a href="#impl-Debug-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#559-561">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-%26ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#589-596">Source</a><a href="#impl-Default-for-%26ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for &<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#593-595">Source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.93.1/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-EncodeAsVarULE%3CZeroSlice%3CT%3E%3E-for-%26%5BT%5D" class="impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#179-202">Source</a><a href="#impl-EncodeAsVarULE%3CZeroSlice%3CT%3E%3E-for-%26%5BT%5D" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="ule/trait.EncodeAsVarULE.html" title="trait zerovec::ule::EncodeAsVarULE">EncodeAsVarULE</a><<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>> for &<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + 'static,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.encode_var_ule_as_slices" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#183-186">Source</a><a href="#method.encode_var_ule_as_slices" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.EncodeAsVarULE.html#tymethod.encode_var_ule_as_slices" class="fn">encode_var_ule_as_slices</a><R>(&self, _: impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&[&[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]]) -> R) -> R</h4></section></summary><div class='docblock'>Calls <code>cb</code> with a piecewise list of byte slices that when concatenated
|
||
produce the memory pattern of the corresponding instance of <code>T</code>. <a href="ule/trait.EncodeAsVarULE.html#tymethod.encode_var_ule_as_slices">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.encode_var_ule_len" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#189-191">Source</a><a href="#method.encode_var_ule_len" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.EncodeAsVarULE.html#method.encode_var_ule_len" class="fn">encode_var_ule_len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Return the length, in bytes, of the corresponding <a href="ule/trait.VarULE.html" title="trait zerovec::ule::VarULE"><code>VarULE</code></a> type</div></details><details class="toggle method-toggle" open><summary><section id="method.encode_var_ule_write" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#193-201">Source</a><a href="#method.encode_var_ule_write" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.EncodeAsVarULE.html#method.encode_var_ule_write" class="fn">encode_var_ule_write</a>(&self, dst: &mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>])</h4></section></summary><div class='docblock'>Write the corresponding <a href="ule/trait.VarULE.html" title="trait zerovec::ule::VarULE"><code>VarULE</code></a> type to the <code>dst</code> buffer. <code>dst</code> should
|
||
be the size of <a href="ule/trait.EncodeAsVarULE.html#method.encode_var_ule_len"><code>Self::encode_var_ule_len()</code></a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-EncodeAsVarULE%3CZeroSlice%3CT%3E%3E-for-ZeroVec%3C'_,+T%3E" class="impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#225-243">Source</a><a href="#impl-EncodeAsVarULE%3CZeroSlice%3CT%3E%3E-for-ZeroVec%3C'_,+T%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="ule/trait.EncodeAsVarULE.html" title="trait zerovec::ule::EncodeAsVarULE">EncodeAsVarULE</a><<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>> for <a class="struct" href="struct.ZeroVec.html" title="struct zerovec::ZeroVec">ZeroVec</a><'_, T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + 'static,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.encode_var_ule_as_slices-1" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#229-232">Source</a><a href="#method.encode_var_ule_as_slices-1" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.EncodeAsVarULE.html#tymethod.encode_var_ule_as_slices" class="fn">encode_var_ule_as_slices</a><R>(&self, _: impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&[&[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]]) -> R) -> R</h4></section></summary><div class='docblock'>Calls <code>cb</code> with a piecewise list of byte slices that when concatenated
|
||
produce the memory pattern of the corresponding instance of <code>T</code>. <a href="ule/trait.EncodeAsVarULE.html#tymethod.encode_var_ule_as_slices">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.encode_var_ule_len-1" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#235-237">Source</a><a href="#method.encode_var_ule_len-1" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.EncodeAsVarULE.html#method.encode_var_ule_len" class="fn">encode_var_ule_len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Return the length, in bytes, of the corresponding <a href="ule/trait.VarULE.html" title="trait zerovec::ule::VarULE"><code>VarULE</code></a> type</div></details><details class="toggle method-toggle" open><summary><section id="method.encode_var_ule_write-1" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#239-242">Source</a><a href="#method.encode_var_ule_write-1" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.EncodeAsVarULE.html#method.encode_var_ule_write" class="fn">encode_var_ule_write</a>(&self, dst: &mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>])</h4></section></summary><div class='docblock'>Write the corresponding <a href="ule/trait.VarULE.html" title="trait zerovec::ule::VarULE"><code>VarULE</code></a> type to the <code>dst</code> buffer. <code>dst</code> should
|
||
be the size of <a href="ule/trait.EncodeAsVarULE.html#method.encode_var_ule_len"><code>Self::encode_var_ule_len()</code></a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#570-574">Source</a><a href="#impl-Ord-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#571-573">Source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&self, other: &Self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%5BT%5D%3E-for-ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#525-533">Source</a><a href="#impl-PartialEq%3C%5BT%5D%3E-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-1" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#530-532">Source</a><a href="#method.eq-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.slice.html">[T]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-1" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
|
||
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CZeroSlice%3CT%3E%3E-for-ZeroVec%3C'a,+T%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#545-553">Source</a><a href="#impl-PartialEq%3CZeroSlice%3CT%3E%3E-for-ZeroVec%3C'a,+T%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>> for <a class="struct" href="struct.ZeroVec.html" title="struct zerovec::ZeroVec">ZeroVec</a><'a, T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-3" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#550-552">Source</a><a href="#method.eq-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-3" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
|
||
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CZeroVec%3C'a,+T%3E%3E-for-ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#535-543">Source</a><a href="#impl-PartialEq%3CZeroVec%3C'a,+T%3E%3E-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<'a, T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.ZeroVec.html" title="struct zerovec::ZeroVec">ZeroVec</a><'a, T>> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-2" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#540-542">Source</a><a href="#method.eq-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.ZeroVec.html" title="struct zerovec::ZeroVec">ZeroVec</a><'a, T>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-2" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
|
||
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq-for-ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#515-523">Source</a><a href="#impl-PartialEq-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#520-522">Source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#264">Source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
|
||
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd-for-ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#564-568">Source</a><a href="#impl-PartialOrd-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#565-567">Source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &Self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#1398">Source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#1416">Source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
|
||
<code><=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#1434">Source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code>
|
||
operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/core/cmp.rs.html#1452">Source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
|
||
the <code>>=</code> operator. <a href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-VarULE-for-ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#501-511">Source</a><a href="#impl-VarULE-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + 'static> <a class="trait" href="ule/trait.VarULE.html" title="trait zerovec::ule::VarULE">VarULE</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.validate_bytes" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#503-505">Source</a><a href="#method.validate_bytes" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.VarULE.html#tymethod.validate_bytes" class="fn">validate_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class='docblock'>Validates a byte slice, <code>&[u8]</code>. <a href="ule/trait.VarULE.html#tymethod.validate_bytes">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.from_bytes_unchecked-1" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#508-510">Source</a><a href="#method.from_bytes_unchecked-1" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="ule/trait.VarULE.html#tymethod.from_bytes_unchecked" class="fn">from_bytes_unchecked</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> &Self</h4></section></summary><div class='docblock'>Takes a byte slice, <code>&[u8]</code>, and return it as <code>&Self</code> with the same lifetime, assuming
|
||
that this byte slice has previously been run through <a href="ule/trait.VarULE.html#method.parse_bytes"><code>Self::parse_bytes()</code></a> with
|
||
success. <a href="ule/trait.VarULE.html#tymethod.from_bytes_unchecked">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.parse_bytes-1" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/mod.rs.html#315-320">Source</a><a href="#method.parse_bytes-1" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.VarULE.html#method.parse_bytes" class="fn">parse_bytes</a>(bytes: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&Self, <a class="enum" href="ule/enum.UleError.html" title="enum zerovec::ule::UleError">UleError</a>></h4></section></summary><div class='docblock'>Parses a byte slice, <code>&[u8]</code>, and return it as <code>&Self</code> with the same lifetime. <a href="ule/trait.VarULE.html#method.parse_bytes">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.as_bytes-1" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/mod.rs.html#353-355">Source</a><a href="#method.as_bytes-1" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.VarULE.html#method.as_bytes" class="fn">as_bytes</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class='docblock'>Given <code>&Self</code>, returns a <code>&[u8]</code> with the same lifetime. <a href="ule/trait.VarULE.html#method.as_bytes">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroFrom%3C'zf,+ZeroSlice%3CT%3E%3E-for-%26ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerofrom_impls.rs.html#34-42">Source</a><a href="#impl-ZeroFrom%3C'zf,+ZeroSlice%3CT%3E%3E-for-%26ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<'zf, T> <a class="trait" href="../zerofrom/zero_from/trait.ZeroFrom.html" title="trait zerofrom::zero_from::ZeroFrom">ZeroFrom</a><'zf, <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>> for &'zf <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: 'static + <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.zero_from-1" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerofrom_impls.rs.html#39-41">Source</a><a href="#method.zero_from-1" class="anchor">§</a><h4 class="code-header">fn <a href="../zerofrom/zero_from/trait.ZeroFrom.html#tymethod.zero_from" class="fn">zero_from</a>(other: &'zf <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>) -> Self</h4></section></summary><div class='docblock'>Clone the other <code>C</code> into a struct that may retain references into <code>C</code>.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ZeroFrom%3C'zf,+ZeroSlice%3CT%3E%3E-for-ZeroVec%3C'zf,+T%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerofrom_impls.rs.html#24-32">Source</a><a href="#impl-ZeroFrom%3C'zf,+ZeroSlice%3CT%3E%3E-for-ZeroVec%3C'zf,+T%3E" class="anchor">§</a><h3 class="code-header">impl<'zf, T> <a class="trait" href="../zerofrom/zero_from/trait.ZeroFrom.html" title="trait zerofrom::zero_from::ZeroFrom">ZeroFrom</a><'zf, <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>> for <a class="struct" href="struct.ZeroVec.html" title="struct zerovec::ZeroVec">ZeroVec</a><'zf, T><div class="where">where
|
||
T: 'static + <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.zero_from" class="method trait-impl"><a class="src rightside" href="../src/zerovec/zerofrom_impls.rs.html#29-31">Source</a><a href="#method.zero_from" class="anchor">§</a><h4 class="code-header">fn <a href="../zerofrom/zero_from/trait.ZeroFrom.html#tymethod.zero_from" class="fn">zero_from</a>(other: &'zf <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T>) -> Self</h4></section></summary><div class='docblock'>Clone the other <code>C</code> into a struct that may retain references into <code>C</code>.</div></details></div></details><section id="impl-Eq-for-ZeroSlice%3CT%3E" class="impl"><a class="src rightside" href="../src/zerovec/zerovec/slice.rs.html#513">Source</a><a href="#impl-Eq-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
T: <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a>,</div></h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-ZeroSlice%3CT%3E" class="impl"><a href="#impl-Freeze-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
<T as <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>>::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a>,</div></h3></section><section id="impl-RefUnwindSafe-for-ZeroSlice%3CT%3E" class="impl"><a href="#impl-RefUnwindSafe-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
<T as <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>>::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Send-for-ZeroSlice%3CT%3E" class="impl"><a href="#impl-Send-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
<T as <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>>::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Sized-for-ZeroSlice%3CT%3E" class="impl"><a href="#impl-Sized-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> !<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T></h3></section><section id="impl-Sync-for-ZeroSlice%3CT%3E" class="impl"><a href="#impl-Sync-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
<T as <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>>::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section><section id="impl-Unpin-for-ZeroSlice%3CT%3E" class="impl"><a href="#impl-Unpin-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
<T as <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>>::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnwindSafe-for-ZeroSlice%3CT%3E" class="impl"><a href="#impl-UnwindSafe-for-ZeroSlice%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.ZeroSlice.html" title="struct zerovec::ZeroSlice">ZeroSlice</a><T><div class="where">where
|
||
<T as <a class="trait" href="ule/trait.AsULE.html" title="trait zerovec::ule::AsULE">AsULE</a>>::<a class="associatedtype" href="ule/trait.AsULE.html#associatedtype.ULE" title="type zerovec::ule::AsULE::ULE">ULE</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</div></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#212">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#214">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#221">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#222">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-EncodeAsVarULE%3CT%3E-for-T" class="impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#111-115">Source</a><a href="#impl-EncodeAsVarULE%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="ule/trait.EncodeAsVarULE.html" title="trait zerovec::ule::EncodeAsVarULE">EncodeAsVarULE</a><T> for T<div class="where">where
|
||
T: <a class="trait" href="ule/trait.VarULE.html" title="trait zerovec::ule::VarULE">VarULE</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.encode_var_ule_as_slices-2" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#112-114">Source</a><a href="#method.encode_var_ule_as_slices-2" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.EncodeAsVarULE.html#tymethod.encode_var_ule_as_slices" class="fn">encode_var_ule_as_slices</a><R>(&self, cb: impl <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&[&[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]]) -> R) -> R</h4></section></summary><div class='docblock'>Calls <code>cb</code> with a piecewise list of byte slices that when concatenated
|
||
produce the memory pattern of the corresponding instance of <code>T</code>. <a href="ule/trait.EncodeAsVarULE.html#tymethod.encode_var_ule_as_slices">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.encode_var_ule_len-2" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#74-76">Source</a><a href="#method.encode_var_ule_len-2" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.EncodeAsVarULE.html#method.encode_var_ule_len" class="fn">encode_var_ule_len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Return the length, in bytes, of the corresponding <a href="ule/trait.VarULE.html" title="trait zerovec::ule::VarULE"><code>VarULE</code></a> type</div></details><details class="toggle method-toggle" open><summary><section id="method.encode_var_ule_write-2" class="method trait-impl"><a class="src rightside" href="../src/zerovec/ule/encode.rs.html#80-89">Source</a><a href="#method.encode_var_ule_write-2" class="anchor">§</a><h4 class="code-header">fn <a href="ule/trait.EncodeAsVarULE.html#method.encode_var_ule_write" class="fn">encode_var_ule_write</a>(&self, dst: &mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>])</h4></section></summary><div class='docblock'>Write the corresponding <a href="ule/trait.VarULE.html" title="trait zerovec::ule::VarULE"><code>VarULE</code></a> type to the <code>dst</code> buffer. <code>dst</code> should
|
||
be the size of <a href="ule/trait.EncodeAsVarULE.html#method.encode_var_ule_len"><code>Self::encode_var_ule_len()</code></a></div></details></div></details></div><script type="text/json" id="notable-traits-data">{"&[u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.93.1/std/primitive.u8.html\">u8</a>]</div>","ZeroSliceIter<'a, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"vecs/struct.ZeroSliceIter.html\" title=\"struct zerovec::vecs::ZeroSliceIter\">ZeroSliceIter</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T: <a class=\"trait\" href=\"ule/trait.AsULE.html\" title=\"trait zerovec::ule::AsULE\">AsULE</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"vecs/struct.ZeroSliceIter.html\" title=\"struct zerovec::vecs::ZeroSliceIter\">ZeroSliceIter</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = T;</div>"}</script></section></div></main></body></html> |