mirror of
https://github.com/Rust-GPU/rust-gpu.git
synced 2026-06-09 11:09:52 +09:00
36 lines
18 KiB
HTML
36 lines
18 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="API documentation for the Rust `RawStrIndex` trait in crate `raw_string`."><meta name="keywords" content="rust, rustlang, rust-lang, RawStrIndex"><title>raw_string::RawStrIndex - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
|
||
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
|
||
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[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">☰</div><a href='../raw_string/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Trait RawStrIndex</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Output">Output</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.get">get</a><a href="#tymethod.get_mut">get_mut</a><a href="#tymethod.get_unchecked">get_unchecked</a><a href="#tymethod.get_unchecked_mut">get_unchecked_mut</a><a href="#tymethod.index">index</a><a href="#tymethod.index_mut">index_mut</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class="location"><a href="index.html">raw_string</a></p><script>window.sidebarCurrent = {name: "RawStrIndex", ty: "trait", relpath: ""};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press βSβ to search, β?β for more optionsβ¦" type="search"></div><span class="help-button">?</span>
|
||
<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">−</span>]</a></span><a class="srclink" href="../src/raw_string/str/index.rs.html#29-44" title="goto source code">[src]</a></span><span class="in-band">Trait <a href="index.html">raw_string</a>::<wbr><a class="trait" href="">RawStrIndex</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust trait">pub trait RawStrIndex {
|
||
type <a href="#associatedtype.Output" class="type">Output</a>: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>;
|
||
fn <a href="#tymethod.get" class="fnname">get</a>(self, s: &<a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>>;
|
||
<div class="item-spacer"></div> fn <a href="#tymethod.get_mut" class="fnname">get_mut</a>(self, s: &mut <a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&mut Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>>;
|
||
<div class="item-spacer"></div> unsafe fn <a href="#tymethod.get_unchecked" class="fnname">get_unchecked</a>(self, s: &<a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>;
|
||
<div class="item-spacer"></div> unsafe fn <a href="#tymethod.get_unchecked_mut" class="fnname">get_unchecked_mut</a>(self, s: &mut <a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &mut Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>;
|
||
<div class="item-spacer"></div> fn <a href="#tymethod.index" class="fnname">index</a>(self, s: &<a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>;
|
||
<div class="item-spacer"></div> fn <a href="#tymethod.index_mut" class="fnname">index_mut</a>(self, s: &mut <a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &mut Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>;
|
||
}</pre></div><div class="docblock"><p>The equivalent of <code>SliceIndex</code> for <code>RawStr</code>.</p>
|
||
<h1 id="usage" class="section-header"><a href="#usage">Usage</a></h1>
|
||
<p>Normally, this trait is not used directly.
|
||
Its functionality is exposed through <code>Index</code> and the <code>get</code> methods of <code>RawStr</code>.</p>
|
||
<h1 id="implementors-1" class="section-header"><a href="#implementors-1">Implementors</a></h1>
|
||
<p><code>RawStrIndex</code> is automatically implemented for all that implement <code>SliceIndex<[u8]></code>:</p>
|
||
<ul>
|
||
<li>a <code>SliceIndex<[u8], Output=[u8]></code> automatically implements <code>RawStrIndex<Output=RawStr></code>, and</li>
|
||
<li>a <code>SliceIndex<[u8], Output=u8></code> automatically implements <code>RawStrIndex<Output=u8></code>.</li>
|
||
</ul>
|
||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> <span class="ident">RawStr</span>::<span class="ident">from_str</span>(<span class="string">"hello world"</span>);
|
||
<span class="kw">let</span> <span class="ident">hello</span>: <span class="kw-2">&</span><span class="ident">RawStr</span> <span class="op">=</span> <span class="kw-2">&</span><span class="ident">s</span>[..<span class="number">5</span>]; <span class="comment">// This is a slice.</span>
|
||
<span class="kw">let</span> <span class="ident">space</span>: <span class="ident">u8</span> <span class="op">=</span> <span class="ident">s</span>[<span class="number">5</span>]; <span class="comment">// This is a single byte</span>
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">hello</span>, <span class="string">"hello"</span>);
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">space</span>, <span class="string">b' '</span>);</pre></div>
|
||
</div><h2 id="associated-types" class="small-section-header">Associated Types<a href="#associated-types" class="anchor"></a></h2><div class="methods"><h3 id="associatedtype.Output" class="method"><code>type <a href="#associatedtype.Output" class="type">Output</a>: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></code></h3><div class="docblock"><p><code>RawStr</code> (for ranges) or <code>u8</code> (for single indexes).</p>
|
||
</div></div><span class="loading-content">Loading content...</span><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><h3 id="tymethod.get" class="method"><code>fn <a href="#tymethod.get" class="fnname">get</a>(self, s: &<a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>></code></h3><div class="docblock"><p>Get the range or byte from the given <code>&RawStr</code>.</p>
|
||
</div><h3 id="tymethod.get_mut" class="method"><code>fn <a href="#tymethod.get_mut" class="fnname">get_mut</a>(self, s: &mut <a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&mut Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>></code></h3><div class="docblock"><p>Get the (mutable) range or byte from the given <code>&mut RawStr</code>.</p>
|
||
</div><h3 id="tymethod.get_unchecked" class="method"><code>unsafe fn <a href="#tymethod.get_unchecked" class="fnname">get_unchecked</a>(self, s: &<a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a></code></h3><div class="docblock"><p>Like <code>get</code>, but unsafe and unchecked.</p>
|
||
</div><h3 id="tymethod.get_unchecked_mut" class="method"><code>unsafe fn <a href="#tymethod.get_unchecked_mut" class="fnname">get_unchecked_mut</a>(self, s: &mut <a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &mut Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a></code></h3><div class="docblock"><p>Like <code>get_mut</code>, but unsafe and unchecked.</p>
|
||
</div><h3 id="tymethod.index" class="method"><code>fn <a href="#tymethod.index" class="fnname">index</a>(self, s: &<a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a></code></h3><div class="docblock"><p>Like <code>get</code>, but panics on failure.</p>
|
||
</div><h3 id="tymethod.index_mut" class="method"><code>fn <a href="#tymethod.index_mut" class="fnname">index_mut</a>(self, s: &mut <a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &mut Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a></code></h3><div class="docblock"><p>Like <code>get_mut</code>, but panics on failure.</p>
|
||
</div></div><span class="loading-content">Loading content...</span><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><h3 id="impl-RawStrIndex" class="impl"><code class="in-band">impl<I> RawStrIndex for I <span class="where fmt-newline">where<br> I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>>,<br> I::<a class="type" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a>: RawStrIndexOutput + 'static, </span></code><a href="#impl-RawStrIndex" class="anchor"></a><a class="srclink" href="../src/raw_string/str/index.rs.html#77-109" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Output-1" class="type"><code>type <a href="#associatedtype.Output-1" class="type">Output</a> = <<I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a> as RawStrIndexOutput>::Output</code></h4><h4 id="method.get" class="method hidden"><code>fn <a href="#method.get" class="fnname">get</a>(self, s: &<a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>></code><a class="srclink" href="../src/raw_string/str/index.rs.html#84-86" title="goto source code">[src]</a></h4><h4 id="method.get_mut" class="method hidden"><code>fn <a href="#method.get_mut" class="fnname">get_mut</a>(self, s: &mut <a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&mut Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a>></code><a class="srclink" href="../src/raw_string/str/index.rs.html#88-92" title="goto source code">[src]</a></h4><h4 id="method.get_unchecked" class="method hidden"><code>unsafe fn <a href="#method.get_unchecked" class="fnname">get_unchecked</a>(self, s: &<a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a></code><a class="srclink" href="../src/raw_string/str/index.rs.html#94-96" title="goto source code">[src]</a></h4><h4 id="method.get_unchecked_mut" class="method hidden"><code>unsafe fn <a href="#method.get_unchecked_mut" class="fnname">get_unchecked_mut</a>(self, s: &mut <a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &mut Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a></code><a class="srclink" href="../src/raw_string/str/index.rs.html#98-100" title="goto source code">[src]</a></h4><h4 id="method.index" class="method hidden"><code>fn <a href="#method.index" class="fnname">index</a>(self, s: &<a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a></code><a class="srclink" href="../src/raw_string/str/index.rs.html#102-104" title="goto source code">[src]</a></h4><h4 id="method.index_mut" class="method hidden"><code>fn <a href="#method.index_mut" class="fnname">index_mut</a>(self, s: &mut <a class="struct" href="../raw_string/struct.RawStr.html" title="struct raw_string::RawStr">RawStr</a>) -> &mut Self::<a class="type" href="../raw_string/trait.RawStrIndex.html#associatedtype.Output" title="type raw_string::RawStrIndex::Output">Output</a></code><a class="srclink" href="../src/raw_string/str/index.rs.html#106-108" title="goto source code">[src]</a></h4></div></div><span class="loading-content">Loading content...</span><script type="text/javascript" src="../implementors/raw_string/trait.RawStrIndex.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "raw_string";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |