1
0
Fork 0
mirror of https://gitlab.redox-os.org/CoffeeCode/redox-ssh.git synced 2025-12-28 16:42:19 +01:00
redox-ssh/untrusted/struct.Reader.html

163 lines
No EOL
12 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 `Reader` struct in crate `untrusted`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Reader">
<title>untrusted::Reader - Rust</title>
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Struct Reader</p><div class="block items"><ul><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='index.html'>untrusted</a></p><script>window.sidebarCurrent = {name: 'Reader', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>untrusted</a>::<wbr><a class="struct" href=''>Reader</a></span><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/untrusted/untrusted.rs.html#204-207' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Reader&lt;'a&gt; { /* fields omitted */ }</pre><div class='docblock'><p>A read-only, forward-only* cursor into the data in an <code>Input</code>.</p>
<p>Using <code>Reader</code> to parse input helps to ensure that no byte of the input
will be accidentally processed more than once. Using <code>Reader</code> in
conjunction with <code>read_all</code>, <code>read_all_mut</code>, and <code>read_all_optional</code>
helps ensure that no byte of the input is accidentally left unprocessed.
The methods of <code>Reader</code> never panic, so <code>Reader</code> also assists the writing
of panic-free code.</p>
<p>* <code>Reader</code> is not strictly forward-only because of the method
<code>get_input_between_marks</code>, which is provided mainly to support calculating
digests over parsed data.</p>
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl&lt;'a&gt; <a class="struct" href="../untrusted/struct.Reader.html" title="struct untrusted::Reader">Reader</a>&lt;'a&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/untrusted/untrusted.rs.html#214-294' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>(input: <a class="struct" href="../untrusted/struct.Input.html" title="struct untrusted::Input">Input</a>&lt;'a&gt;) -&gt; <a class="struct" href="../untrusted/struct.Reader.html" title="struct untrusted::Reader">Reader</a>&lt;'a&gt;</code></span></h4>
<div class='docblock'><p>Construct a new Reader for the given input. Use <code>read_all</code>,
<code>read_all_mut</code>, or <code>read_all_optional</code> instead of <code>Reader::new</code>
whenever possible.</p>
</div><h4 id='method.at_end' class="method"><span id='at_end.v' class='invisible'><code>fn <a href='#method.at_end' class='fnname'>at_end</a>(&amp;self) -&gt; bool</code></span></h4>
<div class='docblock'><p>Returns <code>true</code> if the reader is at the end of the input, and <code>false</code>
otherwise.</p>
</div><h4 id='method.get_input_between_marks' class="method"><span id='get_input_between_marks.v' class='invisible'><code>fn <a href='#method.get_input_between_marks' class='fnname'>get_input_between_marks</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;mark1: <a class="struct" href="../untrusted/struct.Mark.html" title="struct untrusted::Mark">Mark</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;mark2: <a class="struct" href="../untrusted/struct.Mark.html" title="struct untrusted::Mark">Mark</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../untrusted/struct.Input.html" title="struct untrusted::Input">Input</a>&lt;'a&gt;, <a class="struct" href="../untrusted/struct.EndOfInput.html" title="struct untrusted::EndOfInput">EndOfInput</a>&gt;</code></span></h4>
<div class='docblock'><p>Returns an <code>Input</code> for already-parsed input that has had its boundaries
marked using <code>mark</code>.</p>
</div><h4 id='method.mark' class="method"><span id='mark.v' class='invisible'><code>fn <a href='#method.mark' class='fnname'>mark</a>(&amp;self) -&gt; <a class="struct" href="../untrusted/struct.Mark.html" title="struct untrusted::Mark">Mark</a></code></span></h4>
<div class='docblock'><p>Return the current position of the <code>Reader</code> for future use in a call
to <code>get_input_between_marks</code>.</p>
</div><h4 id='method.peek' class="method"><span id='peek.v' class='invisible'><code>fn <a href='#method.peek' class='fnname'>peek</a>(&amp;self, b: u8) -&gt; bool</code></span></h4>
<div class='docblock'><p>Returns <code>true</code> if there is at least one more byte in the input and that
byte is equal to <code>b</code>, and false otherwise.</p>
</div><h4 id='method.read_byte' class="method"><span id='read_byte.v' class='invisible'><code>fn <a href='#method.read_byte' class='fnname'>read_byte</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;u8, <a class="struct" href="../untrusted/struct.EndOfInput.html" title="struct untrusted::EndOfInput">EndOfInput</a>&gt;</code></span></h4>
<div class='docblock'><p>Reads the next input byte.</p>
<p>Returns <code>Ok(b)</code> where <code>b</code> is the next input byte, or <code>Err(EndOfInput)</code>
if the <code>Reader</code> is at the end of the input.</p>
</div><h4 id='method.skip' class="method"><span id='skip.v' class='invisible'><code>fn <a href='#method.skip' class='fnname'>skip</a>(&amp;mut self, num_bytes: usize) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;(), <a class="struct" href="../untrusted/struct.EndOfInput.html" title="struct untrusted::EndOfInput">EndOfInput</a>&gt;</code></span></h4>
<div class='docblock'><p>Skips <code>num_bytes</code> of the input.</p>
<p>Returns <code>Ok(())</code> if there are at least <code>num_bytes</code> of input remaining,
and <code>Err(EndOfInput)</code> otherwise.</p>
</div><h4 id='method.skip_and_get_input' class="method"><span id='skip_and_get_input.v' class='invisible'><code>fn <a href='#method.skip_and_get_input' class='fnname'>skip_and_get_input</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;num_bytes: usize<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../untrusted/struct.Input.html" title="struct untrusted::Input">Input</a>&lt;'a&gt;, <a class="struct" href="../untrusted/struct.EndOfInput.html" title="struct untrusted::EndOfInput">EndOfInput</a>&gt;</code></span></h4>
<div class='docblock'><p>Skips <code>num_bytes</code> of the input, returning the skipped input as an <code>Input</code>.</p>
<p>Returns <code>Ok(i)</code> where <code>i</code> is an <code>Input</code> if there are at least
<code>num_bytes</code> of input remaining, and <code>Err(EndOfInput)</code> otherwise.</p>
</div><h4 id='method.skip_to_end' class="method"><span id='skip_to_end.v' class='invisible'><code>fn <a href='#method.skip_to_end' class='fnname'>skip_to_end</a>(&amp;mut self) -&gt; <a class="struct" href="../untrusted/struct.Input.html" title="struct untrusted::Input">Input</a>&lt;'a&gt;</code></span></h4>
<div class='docblock'><p>Skips the reader to the end of the input, returning the skipped input
as an <code>Input</code>.</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../untrusted/struct.Reader.html" title="struct untrusted::Reader">Reader</a>&lt;'a&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/untrusted/untrusted.rs.html#203' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div></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>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand 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>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "untrusted";
</script>
<script src="../jquery.js"></script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>