wasmer/rustdoc/scroll/index.html
2019-09-06 15:57:44 -07:00

139 lines
25 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `scroll` crate."><meta name="keywords" content="rust, rustlang, rust-lang, scroll"><title>scroll - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../scroll/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate scroll</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all scroll's items</p></a><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#constants">Constants</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'scroll', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/scroll/lib.rs.html#1-534' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>scroll</a></span></h1><div class='docblock'><h1 id="scroll" class="section-header"><a href="#scroll">Scroll</a></h1>
<pre><code class="language-text,"> _______________
()==( (@==()
'______________'|
| |
| ἀρετή |
__)_____________|
()==( (@==()
'--------------'
</code></pre>
<p>Scroll is a library for efficiently and easily reading/writing types from byte arrays. All the builtin types are supported, e.g., <code>u32</code>, <code>i8</code>, etc., where the type is specified as a type parameter, or type inferred when possible. In addition, it supports zero-copy reading of string slices, or any other kind of slice. The library can be used in a no_std context as well; the <a href="enum.Error.html">Error</a> type only has the <code>IO</code> and <code>String</code> variants if the default features are used, and is <code>no_std</code> safe when compiled without default features.</p>
<p>There are 3 traits for reading that you can import:</p>
<ol>
<li><a href="trait.Pread.html">Pread</a>, for reading (immutable) data at an offset;</li>
<li><a href="trait.Gread.html">Gread</a>, for reading data at an offset which automatically gets incremented by the size;</li>
<li><a href="trait.IOread.html">IOread</a>, for reading <em>simple</em> data out of a <code>std::io::Read</code> based interface, e.g., a stream. (<strong>Note</strong>: only available when compiled with <code>std</code>)</li>
</ol>
<p>Each of these interfaces also have their corresponding writer versions as well, e.g., <a href="trait.Pwrite.html">Pwrite</a>, <a href="trait.Gwrite.html">Gwrite</a>, and <a href="trait.IOwrite.html">IOwrite</a>, respectively.</p>
<p>Most familiar will likely be the <code>Pread</code> trait (inspired from the C function), which in our case takes an immutable reference to self, an immutable offset to read at, (and <em>optionally</em> a parsing context, more on that later), and then returns the deserialized value.</p>
<p>Because self is immutable, <em><strong>all</strong> reads can be performed in parallel</em> and hence are trivially parallelizable.</p>
<p>For most usecases, you can use <a href="https://docs.rs/scroll_derive">scroll_derive</a> to annotate your types with <code>derive(Pread, Pwrite, IOread, IOwrite, SizeWith)</code> to automatically add sensible derive defaults, and you should be ready to roll. For more complex usescases, you can implement the conversion traits yourself, see the <a href="ctx/index.html">context module</a> for more information.</p>
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
<p>A simple example demonstrates its flexibility:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">scroll</span>::{<span class="ident">ctx</span>, <span class="ident">Pread</span>, <span class="ident">LE</span>};
<span class="kw">let</span> <span class="ident">bytes</span>: [<span class="ident">u8</span>; <span class="number">4</span>] <span class="op">=</span> [<span class="number">0xde</span>, <span class="number">0xad</span>, <span class="number">0xbe</span>, <span class="number">0xef</span>];
<span class="comment">// reads a u32 out of `b` with the endianness of the host machine, at offset 0, turbofish-style</span>
<span class="kw">let</span> <span class="ident">number</span>: <span class="ident">u32</span> <span class="op">=</span> <span class="ident">bytes</span>.<span class="ident">pread</span>::<span class="op">&lt;</span><span class="ident">u32</span><span class="op">&gt;</span>(<span class="number">0</span>).<span class="ident">unwrap</span>();
<span class="comment">// ...or a byte, with type ascription on the binding.</span>
<span class="kw">let</span> <span class="ident">byte</span>: <span class="ident">u8</span> <span class="op">=</span> <span class="ident">bytes</span>.<span class="ident">pread</span>(<span class="number">0</span>).<span class="ident">unwrap</span>();
<span class="comment">//If the type is known another way by the compiler, say reading into a struct field, we can omit the turbofish, and type ascription altogether!</span>
<span class="comment">// If we want, we can explicitly add a endianness to read with by calling `pread_with`.</span>
<span class="comment">// The following reads a u32 out of `b` with Big Endian byte order, at offset 0</span>
<span class="kw">let</span> <span class="ident">be_number</span>: <span class="ident">u32</span> <span class="op">=</span> <span class="ident">bytes</span>.<span class="ident">pread_with</span>(<span class="number">0</span>, <span class="ident">scroll</span>::<span class="ident">BE</span>).<span class="ident">unwrap</span>();
<span class="comment">// or a u16 - specify the type either on the variable or with the beloved turbofish</span>
<span class="kw">let</span> <span class="ident">be_number2</span> <span class="op">=</span> <span class="ident">bytes</span>.<span class="ident">pread_with</span>::<span class="op">&lt;</span><span class="ident">u16</span><span class="op">&gt;</span>(<span class="number">2</span>, <span class="ident">scroll</span>::<span class="ident">BE</span>).<span class="ident">unwrap</span>();
<span class="comment">// Scroll has core friendly errors (no allocation). This will have the type `scroll::Error::BadOffset` because it tried to read beyond the bound</span>
<span class="kw">let</span> <span class="ident">byte</span>: <span class="ident">scroll</span>::<span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">i64</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">bytes</span>.<span class="ident">pread</span>(<span class="number">0</span>);
<span class="comment">// Scroll is extensible: as long as the type implements `TryWithCtx`, then you can read your type out of the byte array!</span>
<span class="comment">// We can parse out custom datatypes, or types with lifetimes</span>
<span class="comment">// if they implement the conversion trait `TryFromCtx`; here we parse a C-style \0 delimited &amp;str (safely)</span>
<span class="kw">let</span> <span class="ident">hello</span>: <span class="kw-2">&amp;</span>[<span class="ident">u8</span>] <span class="op">=</span> <span class="string">b&quot;hello_world\0more words&quot;</span>;
<span class="kw">let</span> <span class="ident">hello_world</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="ident">hello</span>.<span class="ident">pread</span>(<span class="number">0</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">&quot;hello_world&quot;</span>, <span class="ident">hello_world</span>);
<span class="comment">// ... and this parses the string if its space separated!</span>
<span class="kw">use</span> <span class="ident">scroll</span>::<span class="ident">ctx</span>::<span class="kw-2">*</span>;
<span class="kw">let</span> <span class="ident">spaces</span>: <span class="kw-2">&amp;</span>[<span class="ident">u8</span>] <span class="op">=</span> <span class="string">b&quot;hello world some junk&quot;</span>;
<span class="kw">let</span> <span class="ident">world</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="ident">spaces</span>.<span class="ident">pread_with</span>(<span class="number">6</span>, <span class="ident">StrCtx</span>::<span class="ident">Delimiter</span>(<span class="ident">SPACE</span>)).<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">&quot;world&quot;</span>, <span class="ident">world</span>);</pre></div>
<h1 id="stdio-api" class="section-header"><a href="#stdio-api"><code>std::io</code> API</a></h1>
<p>Scroll can also read/write simple types from a <code>std::io::Read</code> or <code>std::io::Write</code> implementor. The built-in numeric types are taken care of for you. If you want to read a custom type, you need to implement the <a href="trait.FromCtx.html">FromCtx</a> (<em>how</em> to parse) and <a href="ctx/trait.SizeWith.html">SizeWith</a> (<em>how</em> big the parsed thing will be) traits. You must compile with default features. For example:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">Cursor</span>;
<span class="kw">use</span> <span class="ident">scroll</span>::<span class="ident">IOread</span>;
<span class="kw">let</span> <span class="ident">bytes_</span> <span class="op">=</span> [<span class="number">0x01</span>,<span class="number">0x00</span>,<span class="number">0x00</span>,<span class="number">0x00</span>,<span class="number">0x00</span>,<span class="number">0x00</span>,<span class="number">0x00</span>,<span class="number">0x00</span>, <span class="number">0xef</span>,<span class="number">0xbe</span>,<span class="number">0x00</span>,<span class="number">0x00</span>,];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> <span class="ident">Cursor</span>::<span class="ident">new</span>(<span class="ident">bytes_</span>);
<span class="comment">// this will bump the cursor&#39;s Seek</span>
<span class="kw">let</span> <span class="ident">foo</span> <span class="op">=</span> <span class="ident">bytes</span>.<span class="ident">ioread</span>::<span class="op">&lt;</span><span class="ident">u64</span><span class="op">&gt;</span>().<span class="ident">unwrap</span>();
<span class="comment">// ..ditto</span>
<span class="kw">let</span> <span class="ident">bar</span> <span class="op">=</span> <span class="ident">bytes</span>.<span class="ident">ioread</span>::<span class="op">&lt;</span><span class="ident">u32</span><span class="op">&gt;</span>().<span class="ident">unwrap</span>();</pre></div>
<p>Similarly, we can write to anything that implements <code>std::io::Write</code> quite naturally:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">scroll</span>::{<span class="ident">IOwrite</span>, <span class="ident">LE</span>, <span class="ident">BE</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::{<span class="ident">Write</span>, <span class="ident">Cursor</span>};
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> [<span class="number">0x0u8</span>; <span class="number">10</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cursor</span> <span class="op">=</span> <span class="ident">Cursor</span>::<span class="ident">new</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">bytes</span>[..]);
<span class="ident">cursor</span>.<span class="ident">write_all</span>(<span class="string">b&quot;hello&quot;</span>).<span class="ident">unwrap</span>();
<span class="ident">cursor</span>.<span class="ident">iowrite_with</span>(<span class="number">0xdeadbeef</span> <span class="kw">as</span> <span class="ident">u32</span>, <span class="ident">BE</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">cursor</span>.<span class="ident">into_inner</span>(), [<span class="number">0x68</span>, <span class="number">0x65</span>, <span class="number">0x6c</span>, <span class="number">0x6c</span>, <span class="number">0x6f</span>, <span class="number">0xde</span>, <span class="number">0xad</span>, <span class="number">0xbe</span>, <span class="number">0xef</span>, <span class="number">0x0</span>]);</pre></div>
<h1 id="advanced-uses" class="section-header"><a href="#advanced-uses">Advanced Uses</a></h1>
<p>Scroll is designed to be highly configurable - it allows you to implement various context (<code>Ctx</code>) sensitive traits, which then grants the implementor <em>automatic</em> uses of the <code>Pread</code> and/or <code>Pwrite</code> traits.</p>
<p>For example, suppose we have a datatype and we want to specify how to parse or serialize this datatype out of some arbitrary
byte buffer. In order to do this, we need to provide a <a href="trait.TryFromCtx.html">TryFromCtx</a> impl for our datatype.</p>
<p>In particular, if we do this for the <code>[u8]</code> target, using the convention <code>(usize, YourCtx)</code>, you will automatically get access to
calling <code>pread_with::&lt;YourDatatype&gt;</code> on arrays of bytes.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">scroll</span>::{<span class="self">self</span>, <span class="ident">ctx</span>, <span class="ident">Pread</span>, <span class="ident">BE</span>, <span class="ident">Endian</span>};
<span class="kw">struct</span> <span class="ident">Data</span><span class="op">&lt;</span><span class="lifetime">&#39;a</span><span class="op">&gt;</span> {
<span class="ident">name</span>: <span class="kw-2">&amp;</span><span class="lifetime">&#39;a</span> <span class="ident">str</span>,
<span class="ident">id</span>: <span class="ident">u32</span>,
}
<span class="comment">// note the lifetime specified here</span>
<span class="kw">impl</span><span class="op">&lt;</span><span class="lifetime">&#39;a</span><span class="op">&gt;</span> <span class="ident">ctx</span>::<span class="ident">TryFromCtx</span><span class="op">&lt;</span><span class="lifetime">&#39;a</span>, <span class="ident">Endian</span><span class="op">&gt;</span> <span class="kw">for</span> <span class="ident">Data</span><span class="op">&lt;</span><span class="lifetime">&#39;a</span><span class="op">&gt;</span> {
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">scroll</span>::<span class="ident">Error</span>;
<span class="kw">type</span> <span class="ident">Size</span> <span class="op">=</span> <span class="ident">usize</span>;
<span class="comment">// and the lifetime annotation on `&amp;&#39;a [u8]` here</span>
<span class="kw">fn</span> <span class="ident">try_from_ctx</span> (<span class="ident">src</span>: <span class="kw-2">&amp;</span><span class="lifetime">&#39;a</span> [<span class="ident">u8</span>], <span class="ident">endian</span>: <span class="ident">Endian</span>)
<span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(<span class="self">Self</span>, <span class="self">Self</span>::<span class="ident">Size</span>), <span class="self">Self</span>::<span class="ident">Error</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">offset</span> <span class="op">=</span> <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="number">0</span>;
<span class="kw">let</span> <span class="ident">name</span> <span class="op">=</span> <span class="ident">src</span>.<span class="ident">gread</span>::<span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">str</span><span class="op">&gt;</span>(<span class="ident">offset</span>)<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">id</span> <span class="op">=</span> <span class="ident">src</span>.<span class="ident">gread_with</span>(<span class="ident">offset</span>, <span class="ident">endian</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>((<span class="ident">Data</span> { <span class="ident">name</span>: <span class="ident">name</span>, <span class="ident">id</span>: <span class="ident">id</span> }, <span class="kw-2">*</span><span class="ident">offset</span>))
}
}
<span class="kw">let</span> <span class="ident">bytes</span> <span class="op">=</span> <span class="string">b&quot;UserName\x00\x01\x02\x03\x04&quot;</span>;
<span class="kw">let</span> <span class="ident">data</span> <span class="op">=</span> <span class="ident">bytes</span>.<span class="ident">pread_with</span>::<span class="op">&lt;</span><span class="ident">Data</span><span class="op">&gt;</span>(<span class="number">0</span>, <span class="ident">BE</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">data</span>.<span class="ident">id</span>, <span class="number">0x01020304</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">data</span>.<span class="ident">name</span>.<span class="ident">to_string</span>(), <span class="string">&quot;UserName&quot;</span>.<span class="ident">to_string</span>());</pre></div>
<p>Please see the <a href="trait.Pread.html#implementing-your-own-reader">Pread documentation examples</a></p>
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table><tr class='module-item'><td><a class="mod" href="ctx/index.html" title='scroll::ctx mod'>ctx</a></td><td class='docblock-short'><p>Generic context-aware conversion traits, for automatic <em>downstream</em> extension of <code>Pread</code>, et. al</p>
</td></tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.Sleb128.html" title='scroll::Sleb128 struct'>Sleb128</a></td><td class='docblock-short'><p>An signed leb128 integer</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Uleb128.html" title='scroll::Uleb128 struct'>Uleb128</a></td><td class='docblock-short'><p>An unsigned leb128 integer</p>
</td></tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
<table><tr class='module-item'><td><a class="enum" href="enum.Endian.html" title='scroll::Endian enum'>Endian</a></td><td class='docblock-short'><p>The endianness (byte order) of a stream of bytes</p>
</td></tr><tr class='module-item'><td><a class="enum" href="enum.Error.html" title='scroll::Error enum'>Error</a></td><td class='docblock-short'><p>A custom Scroll error</p>
</td></tr></table><h2 id='constants' class='section-header'><a href="#constants">Constants</a></h2>
<table><tr class='module-item'><td><a class="constant" href="constant.BE.html" title='scroll::BE constant'>BE</a></td><td class='docblock-short'><p>Big Endian byte order context</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.LE.html" title='scroll::LE constant'>LE</a></td><td class='docblock-short'><p>Little Endian byte order context</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.NATIVE.html" title='scroll::NATIVE constant'>NATIVE</a></td><td class='docblock-short'><p>The machine's native byte order</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.NETWORK.html" title='scroll::NETWORK constant'>NETWORK</a></td><td class='docblock-short'><p>Network byte order context</p>
</td></tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
<table><tr class='module-item'><td><a class="trait" href="trait.Cread.html" title='scroll::Cread trait'>Cread</a></td><td class='docblock-short'><p>Core-read - core, no_std friendly trait for reading basic traits from byte buffers. Cannot fail unless the buffer is too small, in which case an assert fires and the program panics.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.Cwrite.html" title='scroll::Cwrite trait'>Cwrite</a></td><td class='docblock-short'><p>Core-write - core, no_std friendly trait for writing basic types into byte buffers. Cannot fail unless the buffer is too small, in which case an assert fires and the program panics.
Similar to <a href="trait.Cread.html">Cread</a>, if your type implements <a href="trait.IntoCtx.html">IntoCtx</a> then you can <code>cwrite(your_type, offset)</code>.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.IOread.html" title='scroll::IOread trait'>IOread</a></td><td class='docblock-short'><p>An extension trait to <code>std::io::Read</code> streams; this only deserializes simple types, like <code>u8</code>, <code>i32</code>, <code>f32</code>, <code>usize</code>, etc.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.IOwrite.html" title='scroll::IOwrite trait'>IOwrite</a></td><td class='docblock-short'><p>An extension trait to <code>std::io::Write</code> streams; this only serializes simple types, like <code>u8</code>, <code>i32</code>, <code>f32</code>, <code>usize</code>, etc.</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.Pread.html" title='scroll::Pread trait'>Pread</a></td><td class='docblock-short'><p>A very generic, contextual pread interface in Rust. Allows completely parallelized reads, as <code>Self</code> is immutable</p>
</td></tr><tr class='module-item'><td><a class="trait" href="trait.Pwrite.html" title='scroll::Pwrite trait'>Pwrite</a></td><td class='docblock-short'><p>Writes into <code>Self</code> at an offset of type <code>I</code> using a <code>Ctx</code></p>
</td></tr></table><h2 id='types' class='section-header'><a href="#types">Type Definitions</a></h2>
<table><tr class='module-item'><td><a class="type" href="type.Result.html" title='scroll::Result type'>Result</a></td><td class='docblock-short'></td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "scroll";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>