343 lines
No EOL
28 KiB
HTML
343 lines
No EOL
28 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 `BufRead` trait in crate `bitflags`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, BufRead">
|
||
|
||
<title>bitflags::__core::io::BufRead - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../../../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc">
|
||
<!--[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'><a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a href='index.html'>io</a></p><script>window.sidebarCurrent = {name: 'BufRead', ty: 'trait', 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 trait">
|
||
<h1 class='fqn'><span class='in-band'>Trait <a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a href='index.html'>io</a>::<wbr><a class='trait' href=''>BufRead</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'>−</span>]
|
||
</a>
|
||
</span><a id='src-4963' class='srclink' href='https://doc.rust-lang.org/nightly/std/io/trait.BufRead.html?gotosrc=4963' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust trait'>pub trait BufRead: <a class='trait' href='../../../bitflags/__core/io/trait.Read.html' title='bitflags::__core::io::Read'>Read</a> {
|
||
fn <a href='#tymethod.fill_buf' class='fnname'>fill_buf</a>(&mut self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>&[</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>]</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>>;
|
||
fn <a href='#tymethod.consume' class='fnname'>consume</a>(&mut self, amt: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>);
|
||
|
||
fn <a href='#method.read_until' class='fnname'>read_until</a>(&mut self, byte: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a>, buf: &mut <a class='struct' href='../../../bitflags/__core/vec/struct.Vec.html' title='bitflags::__core::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a>>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>> { ... }
|
||
fn <a href='#method.read_line' class='fnname'>read_line</a>(&mut self, buf: &mut <a class='struct' href='../../../bitflags/__core/string/struct.String.html' title='bitflags::__core::string::String'>String</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>> { ... }
|
||
fn <a href='#method.split' class='fnname'>split</a>(self, byte: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a>) -> <a class='struct' href='../../../bitflags/__core/io/struct.Split.html' title='bitflags::__core::io::Split'>Split</a><Self> { ... }
|
||
fn <a href='#method.lines' class='fnname'>lines</a>(self) -> <a class='struct' href='../../../bitflags/__core/io/struct.Lines.html' title='bitflags::__core::io::Lines'>Lines</a><Self> { ... }
|
||
}</pre><div class='docblock'><p>A <code>BufRead</code> is a type of <code>Read</code>er which has an internal buffer, allowing it
|
||
to perform extra ways of reading.</p>
|
||
|
||
<p>For example, reading line-by-line is inefficient without using a buffer, so
|
||
if you want to read by line, you'll need <code>BufRead</code>, which includes a
|
||
<a href="#method.read_line"><code>read_line()</code></a> method as well as a <a href="#method.lines"><code>lines()</code></a> iterator.</p>
|
||
|
||
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
|
||
<p>A locked standard input implements <code>BufRead</code>:</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>;
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>prelude</span>::<span class='op'>*</span>;
|
||
|
||
<span class='kw'>let</span> <span class='ident'>stdin</span> <span class='op'>=</span> <span class='ident'>io</span>::<span class='ident'>stdin</span>();
|
||
<span class='kw'>for</span> <span class='ident'>line</span> <span class='kw'>in</span> <span class='ident'>stdin</span>.<span class='ident'>lock</span>().<span class='ident'>lines</span>() {
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{}"</span>, <span class='ident'>line</span>.<span class='ident'>unwrap</span>());
|
||
}</pre>
|
||
|
||
<p>If you have something that implements <code>Read</code>, you can use the <a href="struct.BufReader.html"><code>BufReader</code>
|
||
type</a> to turn it into a <code>BufRead</code>.</p>
|
||
|
||
<p>For example, <a href="../fs/struct.File.html"><code>File</code></a> implements <code>Read</code>, but not <code>BufRead</code>.
|
||
<code>BufReader</code> to the rescue!</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::{<span class='self'>self</span>, <span class='ident'>BufReader</span>};
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>prelude</span>::<span class='op'>*</span>;
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>fs</span>::<span class='ident'>File</span>;
|
||
|
||
<span class='kw'>let</span> <span class='ident'>f</span> <span class='op'>=</span> <span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>File</span>::<span class='ident'>open</span>(<span class='string'>"foo.txt"</span>));
|
||
<span class='kw'>let</span> <span class='ident'>f</span> <span class='op'>=</span> <span class='ident'>BufReader</span>::<span class='ident'>new</span>(<span class='ident'>f</span>);
|
||
|
||
<span class='kw'>for</span> <span class='ident'>line</span> <span class='kw'>in</span> <span class='ident'>f</span>.<span class='ident'>lines</span>() {
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{}"</span>, <span class='ident'>line</span>.<span class='ident'>unwrap</span>());
|
||
}
|
||
</pre>
|
||
</div>
|
||
<h2 id='required-methods'>Required Methods</h2>
|
||
<div class='methods'>
|
||
<h3 id='tymethod.fill_buf' class='method stab '><code>fn <a href='#tymethod.fill_buf' class='fnname'>fill_buf</a>(&mut self) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>&[</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>]</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code></h3><div class='docblock'><p>Fills the internal buffer of this object, returning the buffer contents.</p>
|
||
|
||
<p>This function is a lower-level call. It needs to be paired with the
|
||
<a href="#tymethod.consume"><code>consume</code></a> method to function properly. When calling this
|
||
method, none of the contents will be "read" in the sense that later
|
||
calling <code>read</code> may return the same contents. As such, <code>consume</code> must be
|
||
called with the number of bytes that are consumed from this buffer to
|
||
ensure that the bytes are never returned twice.</p>
|
||
|
||
<p>An empty buffer returned indicates that the stream has reached EOF.</p>
|
||
|
||
<h1 id='errors' class='section-header'><a href='#errors'>Errors</a></h1>
|
||
<p>This function will return an I/O error if the underlying reader was
|
||
read, but returned an error.</p>
|
||
|
||
<h1 id='examples-1' class='section-header'><a href='#examples-1'>Examples</a></h1>
|
||
<p>A locked standard input implements <code>BufRead</code>:</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>;
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>prelude</span>::<span class='op'>*</span>;
|
||
|
||
<span class='kw'>let</span> <span class='ident'>stdin</span> <span class='op'>=</span> <span class='ident'>io</span>::<span class='ident'>stdin</span>();
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>stdin</span> <span class='op'>=</span> <span class='ident'>stdin</span>.<span class='ident'>lock</span>();
|
||
|
||
<span class='comment'>// we can't have two `&mut` references to `stdin`, so use a block</span>
|
||
<span class='comment'>// to end the borrow early.</span>
|
||
<span class='kw'>let</span> <span class='ident'>length</span> <span class='op'>=</span> {
|
||
<span class='kw'>let</span> <span class='ident'>buffer</span> <span class='op'>=</span> <span class='ident'>stdin</span>.<span class='ident'>fill_buf</span>().<span class='ident'>unwrap</span>();
|
||
|
||
<span class='comment'>// work with buffer</span>
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{:?}"</span>, <span class='ident'>buffer</span>);
|
||
|
||
<span class='ident'>buffer</span>.<span class='ident'>len</span>()
|
||
};
|
||
|
||
<span class='comment'>// ensure the bytes we worked with aren't returned again later</span>
|
||
<span class='ident'>stdin</span>.<span class='ident'>consume</span>(<span class='ident'>length</span>);</pre>
|
||
</div><h3 id='tymethod.consume' class='method stab '><code>fn <a href='#tymethod.consume' class='fnname'>consume</a>(&mut self, amt: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>)</code></h3><div class='docblock'><p>Tells this buffer that <code>amt</code> bytes have been consumed from the buffer,
|
||
so they should no longer be returned in calls to <code>read</code>.</p>
|
||
|
||
<p>This function is a lower-level call. It needs to be paired with the
|
||
<a href="#tymethod.fill_buf"><code>fill_buf</code></a> method to function properly. This function does
|
||
not perform any I/O, it simply informs this object that some amount of
|
||
its buffer, returned from <code>fill_buf</code>, has been consumed and should no
|
||
longer be returned. As such, this function may do odd things if
|
||
<code>fill_buf</code> isn't called before calling it.</p>
|
||
|
||
<p>The <code>amt</code> must be <code><=</code> the number of bytes in the buffer returned by
|
||
<code>fill_buf</code>.</p>
|
||
|
||
<h1 id='examples-2' class='section-header'><a href='#examples-2'>Examples</a></h1>
|
||
<p>Since <code>consume()</code> is meant to be used with <a href="#tymethod.fill_buf"><code>fill_buf()</code></a>,
|
||
that method's example includes an example of <code>consume()</code>.</p>
|
||
</div></div>
|
||
<h2 id='provided-methods'>Provided Methods</h2>
|
||
<div class='methods'>
|
||
<h3 id='method.read_until' class='method stab '><code>fn <a href='#method.read_until' class='fnname'>read_until</a>(&mut self, byte: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a>, buf: &mut <a class='struct' href='../../../bitflags/__core/vec/struct.Vec.html' title='bitflags::__core::vec::Vec'>Vec</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a>>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code></h3><div class='docblock'><p>Read all bytes into <code>buf</code> until the delimiter <code>byte</code> is reached.</p>
|
||
|
||
<p>This function will read bytes from the underlying stream until the
|
||
delimiter or EOF is found. Once found, all bytes up to, and including,
|
||
the delimiter (if found) will be appended to <code>buf</code>.</p>
|
||
|
||
<p>If this reader is currently at EOF then this function will not modify
|
||
<code>buf</code> and will return <code>Ok(n)</code> where <code>n</code> is the number of bytes which
|
||
were read.</p>
|
||
|
||
<h1 id='errors-1' class='section-header'><a href='#errors-1'>Errors</a></h1>
|
||
<p>This function will ignore all instances of <code>ErrorKind::Interrupted</code> and
|
||
will otherwise return any errors returned by <code>fill_buf</code>.</p>
|
||
|
||
<p>If an I/O error is encountered then all bytes read so far will be
|
||
present in <code>buf</code> and its length will have been adjusted appropriately.</p>
|
||
|
||
<h1 id='examples-3' class='section-header'><a href='#examples-3'>Examples</a></h1>
|
||
<p>A locked standard input implements <code>BufRead</code>. In this example, we'll
|
||
read from standard input until we see an <code>a</code> byte.</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>;
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>prelude</span>::<span class='op'>*</span>;
|
||
|
||
<span class='kw'>fn</span> <span class='ident'>foo</span>() <span class='op'>-></span> <span class='ident'>io</span>::<span class='prelude-ty'>Result</span><span class='op'><</span>()<span class='op'>></span> {
|
||
<span class='kw'>let</span> <span class='ident'>stdin</span> <span class='op'>=</span> <span class='ident'>io</span>::<span class='ident'>stdin</span>();
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>stdin</span> <span class='op'>=</span> <span class='ident'>stdin</span>.<span class='ident'>lock</span>();
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>buffer</span> <span class='op'>=</span> <span class='ident'>Vec</span>::<span class='ident'>new</span>();
|
||
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>stdin</span>.<span class='ident'>read_until</span>(<span class='string'>b'a'</span>, <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>buffer</span>));
|
||
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{:?}"</span>, <span class='ident'>buffer</span>);</pre>
|
||
</div><h3 id='method.read_line' class='method stab '><code>fn <a href='#method.read_line' class='fnname'>read_line</a>(&mut self, buf: &mut <a class='struct' href='../../../bitflags/__core/string/struct.String.html' title='bitflags::__core::string::String'>String</a>) -> <a class='enum' href='../../../bitflags/__core/result/enum.Result.html' title='bitflags::__core::result::Result'>Result</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.usize.html'>usize</a>, <a class='struct' href='../../../bitflags/__core/io/struct.Error.html' title='bitflags::__core::io::Error'>Error</a>></code></h3><div class='docblock'><p>Read all bytes until a newline (the 0xA byte) is reached, and append
|
||
them to the provided buffer.</p>
|
||
|
||
<p>This function will read bytes from the underlying stream until the
|
||
newline delimiter (the 0xA byte) or EOF is found. Once found, all bytes
|
||
up to, and including, the delimiter (if found) will be appended to
|
||
<code>buf</code>.</p>
|
||
|
||
<p>If this reader is currently at EOF then this function will not modify
|
||
<code>buf</code> and will return <code>Ok(n)</code> where <code>n</code> is the number of bytes which
|
||
were read.</p>
|
||
|
||
<h1 id='errors-2' class='section-header'><a href='#errors-2'>Errors</a></h1>
|
||
<p>This function has the same error semantics as <code>read_until</code> and will also
|
||
return an error if the read bytes are not valid UTF-8. If an I/O error
|
||
is encountered then <code>buf</code> may contain some bytes already read in the
|
||
event that all data read so far was valid UTF-8.</p>
|
||
|
||
<h1 id='examples-4' class='section-header'><a href='#examples-4'>Examples</a></h1>
|
||
<p>A locked standard input implements <code>BufRead</code>. In this example, we'll
|
||
read all of the lines from standard input. If we were to do this in
|
||
an actual project, the <a href="#method.lines"><code>lines()</code></a> method would be easier, of
|
||
course.</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>;
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>prelude</span>::<span class='op'>*</span>;
|
||
|
||
<span class='kw'>let</span> <span class='ident'>stdin</span> <span class='op'>=</span> <span class='ident'>io</span>::<span class='ident'>stdin</span>();
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>stdin</span> <span class='op'>=</span> <span class='ident'>stdin</span>.<span class='ident'>lock</span>();
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>buffer</span> <span class='op'>=</span> <span class='ident'>String</span>::<span class='ident'>new</span>();
|
||
|
||
<span class='kw'>while</span> <span class='ident'>stdin</span>.<span class='ident'>read_line</span>(<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>buffer</span>).<span class='ident'>unwrap</span>() <span class='op'>></span> <span class='number'>0</span> {
|
||
<span class='comment'>// work with buffer</span>
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{:?}"</span>, <span class='ident'>buffer</span>);
|
||
|
||
<span class='ident'>buffer</span>.<span class='ident'>clear</span>();
|
||
}</pre>
|
||
</div><h3 id='method.split' class='method stab '><code>fn <a href='#method.split' class='fnname'>split</a>(self, byte: <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a>) -> <a class='struct' href='../../../bitflags/__core/io/struct.Split.html' title='bitflags::__core::io::Split'>Split</a><Self></code></h3><div class='docblock'><p>Returns an iterator over the contents of this reader split on the byte
|
||
<code>byte</code>.</p>
|
||
|
||
<p>The iterator returned from this function will return instances of
|
||
<code>io::Result<Vec<u8>></code>. Each vector returned will <em>not</em> have the
|
||
delimiter byte at the end.</p>
|
||
|
||
<p>This function will yield errors whenever <code>read_until</code> would have also
|
||
yielded an error.</p>
|
||
|
||
<h1 id='examples-5' class='section-header'><a href='#examples-5'>Examples</a></h1>
|
||
<p>A locked standard input implements <code>BufRead</code>. In this example, we'll
|
||
read some input from standard input, splitting on commas.</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>;
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>prelude</span>::<span class='op'>*</span>;
|
||
|
||
<span class='kw'>let</span> <span class='ident'>stdin</span> <span class='op'>=</span> <span class='ident'>io</span>::<span class='ident'>stdin</span>();
|
||
|
||
<span class='kw'>for</span> <span class='ident'>content</span> <span class='kw'>in</span> <span class='ident'>stdin</span>.<span class='ident'>lock</span>().<span class='ident'>split</span>(<span class='string'>b','</span>) {
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{:?}"</span>, <span class='ident'>content</span>.<span class='ident'>unwrap</span>());
|
||
}</pre>
|
||
</div><h3 id='method.lines' class='method stab '><code>fn <a href='#method.lines' class='fnname'>lines</a>(self) -> <a class='struct' href='../../../bitflags/__core/io/struct.Lines.html' title='bitflags::__core::io::Lines'>Lines</a><Self></code></h3><div class='docblock'><p>Returns an iterator over the lines of this reader.</p>
|
||
|
||
<p>The iterator returned from this function will yield instances of
|
||
<code>io::Result<String></code>. Each string returned will <em>not</em> have a newline
|
||
byte (the 0xA byte) or CRLF (0xD, 0xA bytes) at the end.</p>
|
||
|
||
<h1 id='examples-6' class='section-header'><a href='#examples-6'>Examples</a></h1>
|
||
<p>A locked standard input implements <code>BufRead</code>:</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>;
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>prelude</span>::<span class='op'>*</span>;
|
||
|
||
<span class='kw'>let</span> <span class='ident'>stdin</span> <span class='op'>=</span> <span class='ident'>io</span>::<span class='ident'>stdin</span>();
|
||
|
||
<span class='kw'>for</span> <span class='ident'>line</span> <span class='kw'>in</span> <span class='ident'>stdin</span>.<span class='ident'>lock</span>().<span class='ident'>lines</span>() {
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{}"</span>, <span class='ident'>line</span>.<span class='ident'>unwrap</span>());
|
||
}</pre>
|
||
</div></div>
|
||
<h2 id='implementors'>Implementors</h2>
|
||
<ul class='item-list' id='implementors-list'>
|
||
<li><code>impl<R> BufRead for <a class='struct' href='../../../bitflags/__core/io/struct.BufReader.html' title='bitflags::__core::io::BufReader'>BufReader</a><R> <span class='where'>where R: <a class='trait' href='../../../bitflags/__core/io/trait.Read.html' title='bitflags::__core::io::Read'>Read</a></span></code></li>
|
||
<li><code>impl<T> BufRead for <a class='struct' href='../../../bitflags/__core/io/struct.Cursor.html' title='bitflags::__core::io::Cursor'>Cursor</a><T> <span class='where'>where T: <a class='trait' href='../../../bitflags/__core/convert/trait.AsRef.html' title='bitflags::__core::convert::AsRef'>AsRef</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>[</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>]</a>></span></code></li>
|
||
<li><code>impl<'a, B> BufRead for &'a mut B <span class='where'>where B: <a class='trait' href='../../../bitflags/__core/io/trait.BufRead.html' title='bitflags::__core::io::BufRead'>BufRead</a> + ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
|
||
<li><code>impl<B> BufRead for <a class='struct' href='../../../bitflags/__core/boxed/struct.Box.html' title='bitflags::__core::boxed::Box'>Box</a><B> <span class='where'>where B: <a class='trait' href='../../../bitflags/__core/io/trait.BufRead.html' title='bitflags::__core::io::BufRead'>BufRead</a> + ?<a class='trait' href='../../../bitflags/__core/marker/trait.Sized.html' title='bitflags::__core::marker::Sized'>Sized</a></span></code></li>
|
||
<li><code>impl<'a> BufRead for <a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>&'a [</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.u8.html'>u8</a><a class='primitive' href='https://doc.rust-lang.org/nightly/bitflags/primitive.slice.html'>]</a></code></li>
|
||
<li><code>impl BufRead for <a class='struct' href='../../../bitflags/__core/io/struct.Empty.html' title='bitflags::__core::io::Empty'>Empty</a></code></li>
|
||
<li><code>impl<'a> BufRead for <a class='struct' href='../../../bitflags/__core/io/struct.StdinLock.html' title='bitflags::__core::io::StdinLock'>StdinLock</a><'a></code></li>
|
||
<li><code>impl<T, U> BufRead for <a class='struct' href='../../../bitflags/__core/io/struct.Chain.html' title='bitflags::__core::io::Chain'>Chain</a><T, U> <span class='where'>where T: <a class='trait' href='../../../bitflags/__core/io/trait.BufRead.html' title='bitflags::__core::io::BufRead'>BufRead</a>, U: <a class='trait' href='../../../bitflags/__core/io/trait.BufRead.html' title='bitflags::__core::io::BufRead'>BufRead</a></span></code></li>
|
||
<li><code>impl<T> BufRead for <a class='struct' href='../../../bitflags/__core/io/struct.Take.html' title='bitflags::__core::io::Take'>Take</a><T> <span class='where'>where T: <a class='trait' href='../../../bitflags/__core/io/trait.BufRead.html' title='bitflags::__core::io::BufRead'>BufRead</a></span></code></li>
|
||
</ul><script type="text/javascript" async
|
||
src="../../../implementors/std/io/trait.BufRead.js">
|
||
</script></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>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</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 = "bitflags";
|
||
window.playgroundUrl = "";
|
||
</script>
|
||
<script src="../../../jquery.js"></script>
|
||
<script src="../../../main.js"></script>
|
||
|
||
<script defer src="../../../search-index.js"></script>
|
||
</body>
|
||
</html> |