571 lines
No EOL
35 KiB
HTML
571 lines
No EOL
35 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 `io` mod in crate `bitflags`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, io">
|
||
|
||
<title>bitflags::__core::io - 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></p><script>window.sidebarCurrent = {name: 'io', ty: 'mod', 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 mod">
|
||
<h1 class='fqn'><span class='in-band'>Module <a href='../../index.html'>bitflags</a>::<wbr><a href='../index.html'>__core</a>::<wbr><a class='mod' href=''>io</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-3913' class='srclink' href='https://doc.rust-lang.org/nightly/std/io/index.html?gotosrc=3913' title='goto source code'>[src]</a></span></h1>
|
||
<div class='docblock'><p>Traits, helpers, and type definitions for core I/O functionality.</p>
|
||
|
||
<p>The <code>std::io</code> module contains a number of common things you'll need
|
||
when doing input and output. The most core part of this module is
|
||
the <a href="trait.Read.html"><code>Read</code></a> and <a href="trait.Write.html"><code>Write</code></a> traits, which provide the
|
||
most general interface for reading and writing input and output.</p>
|
||
|
||
<h1 id='read-and-write' class='section-header'><a href='#read-and-write'>Read and Write</a></h1>
|
||
<p>Because they are traits, <code>Read</code> and <code>Write</code> are implemented by a number
|
||
of other types, and you can implement them for your types too. As such,
|
||
you'll see a few different types of I/O throughout the documentation in
|
||
this module: <code>File</code>s, <code>TcpStream</code>s, and sometimes even <code>Vec<T></code>s. For
|
||
example, <code>Read</code> adds a <code>read()</code> method, which we can use on <code>File</code>s:</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'>use</span> <span class='ident'>std</span>::<span class='ident'>fs</span>::<span class='ident'>File</span>;
|
||
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</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='kw-2'>mut</span> <span class='ident'>buffer</span> <span class='op'>=</span> [<span class='number'>0</span>; <span class='number'>10</span>];
|
||
|
||
<span class='comment'>// read up to 10 bytes</span>
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>f</span>.<span class='ident'>read</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'>"The bytes: {:?}"</span>, <span class='ident'>buffer</span>);</pre>
|
||
|
||
<p><code>Read</code> and <code>Write</code> are so important, implementors of the two traits have a
|
||
nickname: readers and writers. So you'll sometimes see 'a reader' instead
|
||
of 'a type that implements the <code>Read</code> trait'. Much easier!</p>
|
||
|
||
<h2 id='seek-and-bufread' class='section-header'><a href='#seek-and-bufread'>Seek and BufRead</a></h2>
|
||
<p>Beyond that, there are two important traits that are provided: <a href="trait.Seek.html"><code>Seek</code></a>
|
||
and <a href="trait.BufRead.html"><code>BufRead</code></a>. Both of these build on top of a reader to control
|
||
how the reading happens. <code>Seek</code> lets you control where the next byte is
|
||
coming from:</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'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>SeekFrom</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='kw-2'>mut</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='kw-2'>mut</span> <span class='ident'>buffer</span> <span class='op'>=</span> [<span class='number'>0</span>; <span class='number'>10</span>];
|
||
|
||
<span class='comment'>// skip to the last 10 bytes of the file</span>
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>f</span>.<span class='ident'>seek</span>(<span class='ident'>SeekFrom</span>::<span class='ident'>End</span>(<span class='op'>-</span><span class='number'>10</span>)));
|
||
|
||
<span class='comment'>// read up to 10 bytes</span>
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>f</span>.<span class='ident'>read</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'>"The bytes: {:?}"</span>, <span class='ident'>buffer</span>);</pre>
|
||
|
||
<p><code>BufRead</code> uses an internal buffer to provide a number of other ways to read, but
|
||
to show it off, we'll need to talk about buffers in general. Keep reading!</p>
|
||
|
||
<h2 id='bufreader-and-bufwriter' class='section-header'><a href='#bufreader-and-bufwriter'>BufReader and BufWriter</a></h2>
|
||
<p>Byte-based interfaces are unwieldy and can be inefficient, as we'd need to be
|
||
making near-constant calls to the operating system. To help with this,
|
||
<code>std::io</code> comes with two structs, <code>BufReader</code> and <code>BufWriter</code>, which wrap
|
||
readers and writers. The wrapper uses a buffer, reducing the number of
|
||
calls and providing nicer methods for accessing exactly what you want.</p>
|
||
|
||
<p>For example, <code>BufReader</code> works with the <code>BufRead</code> trait to add extra
|
||
methods to any reader:</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'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>BufReader</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='kw-2'>mut</span> <span class='ident'>reader</span> <span class='op'>=</span> <span class='ident'>BufReader</span>::<span class='ident'>new</span>(<span class='ident'>f</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='comment'>// read a line into buffer</span>
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>reader</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='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{}"</span>, <span class='ident'>buffer</span>);</pre>
|
||
|
||
<p><code>BufWriter</code> doesn't add any new ways of writing; it just buffers every call
|
||
to <a href="trait.Write.html#tymethod.write"><code>write()</code></a>:</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'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>BufWriter</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'>create</span>(<span class='string'>"foo.txt"</span>));
|
||
{
|
||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>writer</span> <span class='op'>=</span> <span class='ident'>BufWriter</span>::<span class='ident'>new</span>(<span class='ident'>f</span>);
|
||
|
||
<span class='comment'>// write a byte to the buffer</span>
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>writer</span>.<span class='ident'>write</span>(<span class='kw-2'>&</span>[<span class='number'>42</span>]));
|
||
|
||
} <span class='comment'>// the buffer is flushed once writer goes out of scope</span>
|
||
</pre>
|
||
|
||
<h2 id='standard-input-and-output' class='section-header'><a href='#standard-input-and-output'>Standard input and output</a></h2>
|
||
<p>A very common source of input is standard input:</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'>let</span> <span class='kw-2'>mut</span> <span class='ident'>input</span> <span class='op'>=</span> <span class='ident'>String</span>::<span class='ident'>new</span>();
|
||
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>io</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'>input</span>));
|
||
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"You typed: {}"</span>, <span class='ident'>input</span>.<span class='ident'>trim</span>());</pre>
|
||
|
||
<p>And a very common source of output is standard output:</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='macro'>try</span><span class='macro'>!</span>(<span class='ident'>io</span>::<span class='ident'>stdout</span>().<span class='ident'>write</span>(<span class='kw-2'>&</span>[<span class='number'>42</span>]));</pre>
|
||
|
||
<p>Of course, using <code>io::stdout()</code> directly is less common than something like
|
||
<code>println!</code>.</p>
|
||
|
||
<h2 id='iterator-types' class='section-header'><a href='#iterator-types'>Iterator types</a></h2>
|
||
<p>A large number of the structures provided by <code>std::io</code> are for various
|
||
ways of iterating over I/O. For example, <code>Lines</code> is used to split over
|
||
lines:</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'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>::<span class='ident'>BufReader</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='kw-2'>mut</span> <span class='ident'>reader</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'>reader</span>.<span class='ident'>lines</span>() {
|
||
<span class='kw'>let</span> <span class='ident'>line</span> <span class='op'>=</span> <span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>line</span>);
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"{}"</span>, <span class='ident'>line</span>);
|
||
}
|
||
</pre>
|
||
|
||
<h2 id='functions' class='section-header'><a href='#functions'>Functions</a></h2>
|
||
<p>There are a number of <a href="#functions">functions</a> that offer access to various
|
||
features. For example, we can use three of these functions to copy everything
|
||
from standard input to standard output:</p>
|
||
|
||
<pre class='rust rust-example-rendered'>
|
||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>io</span>;
|
||
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>io</span>::<span class='ident'>copy</span>(<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>io</span>::<span class='ident'>stdin</span>(), <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>io</span>::<span class='ident'>stdout</span>()));</pre>
|
||
|
||
<h2 id='ioresult' class='section-header'><a href='#ioresult'>io::Result</a></h2>
|
||
<p>Last, but certainly not least, is <a href="type.Result.html"><code>io::Result</code></a>. This type is used
|
||
as the return type of many <code>std::io</code> functions that can cause an error, and
|
||
can be returned from your own functions as well. Many of the examples in this
|
||
module use the <a href="../macro.try!.html"><code>try!</code></a> macro:</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'>fn</span> <span class='ident'>read_input</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='kw-2'>mut</span> <span class='ident'>input</span> <span class='op'>=</span> <span class='ident'>String</span>::<span class='ident'>new</span>();
|
||
|
||
<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>io</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'>input</span>));
|
||
|
||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"You typed: {}"</span>, <span class='ident'>input</span>.<span class='ident'>trim</span>());
|
||
|
||
<span class='prelude-val'>Ok</span>(())
|
||
}</pre>
|
||
|
||
<p>The return type of <code>read_input()</code>, <code>io::Result<()></code>, is a very common type
|
||
for functions which don't have a 'real' return value, but do want to return
|
||
errors if they happen. In this case, the only purpose of this function is
|
||
to read the line and print it, so we use <code>()</code>.</p>
|
||
|
||
<h2 id='platform-specific-behavior' class='section-header'><a href='#platform-specific-behavior'>Platform-specific behavior</a></h2>
|
||
<p>Many I/O functions throughout the standard library are documented to indicate
|
||
what various library or syscalls they are delegated to. This is done to help
|
||
applications both understand what's happening under the hood as well as investigate
|
||
any possibly unclear semantics. Note, however, that this is informative, not a binding
|
||
contract. The implementation of many of these functions are subject to change over
|
||
time and may call fewer or more syscalls/library functions.</p>
|
||
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class='mod' href='prelude/index.html'
|
||
title='bitflags::__core::io::prelude'>prelude</a></td>
|
||
<td class='docblock short'>
|
||
<p>The I/O Prelude</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.BufReader.html'
|
||
title='bitflags::__core::io::BufReader'>BufReader</a></td>
|
||
<td class='docblock short'>
|
||
<p>The <code>BufReader</code> struct adds buffering to any reader.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.BufWriter.html'
|
||
title='bitflags::__core::io::BufWriter'>BufWriter</a></td>
|
||
<td class='docblock short'>
|
||
<p>Wraps a writer and buffers its output.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Bytes.html'
|
||
title='bitflags::__core::io::Bytes'>Bytes</a></td>
|
||
<td class='docblock short'>
|
||
<p>An iterator over <code>u8</code> values of a reader.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Chain.html'
|
||
title='bitflags::__core::io::Chain'>Chain</a></td>
|
||
<td class='docblock short'>
|
||
<p>Adaptor to chain together two readers.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Cursor.html'
|
||
title='bitflags::__core::io::Cursor'>Cursor</a></td>
|
||
<td class='docblock short'>
|
||
<p>A <code>Cursor</code> wraps another type and provides it with a
|
||
<a href="trait.Seek.html"><code>Seek</code></a> implementation.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Empty.html'
|
||
title='bitflags::__core::io::Empty'>Empty</a></td>
|
||
<td class='docblock short'>
|
||
<p>A reader which is always at EOF.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Error.html'
|
||
title='bitflags::__core::io::Error'>Error</a></td>
|
||
<td class='docblock short'>
|
||
<p>The error type for I/O operations of the <code>Read</code>, <code>Write</code>, <code>Seek</code>, and
|
||
associated traits.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.IntoInnerError.html'
|
||
title='bitflags::__core::io::IntoInnerError'>IntoInnerError</a></td>
|
||
<td class='docblock short'>
|
||
<p>An error returned by <code>into_inner</code> which combines an error that
|
||
happened while writing out the buffer, and the buffered writer object
|
||
which may be used to recover from the condition.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.LineWriter.html'
|
||
title='bitflags::__core::io::LineWriter'>LineWriter</a></td>
|
||
<td class='docblock short'>
|
||
<p>Wraps a writer and buffers output to it, flushing whenever a newline
|
||
(<code>0x0a</code>, <code>'\n'</code>) is detected.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Lines.html'
|
||
title='bitflags::__core::io::Lines'>Lines</a></td>
|
||
<td class='docblock short'>
|
||
<p>An iterator over the lines of an instance of <code>BufRead</code>.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Repeat.html'
|
||
title='bitflags::__core::io::Repeat'>Repeat</a></td>
|
||
<td class='docblock short'>
|
||
<p>A reader which yields one byte over and over and over and over and over and...</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Sink.html'
|
||
title='bitflags::__core::io::Sink'>Sink</a></td>
|
||
<td class='docblock short'>
|
||
<p>A writer which will move data into the void.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Split.html'
|
||
title='bitflags::__core::io::Split'>Split</a></td>
|
||
<td class='docblock short'>
|
||
<p>An iterator over the contents of an instance of <code>BufRead</code> split on a
|
||
particular byte.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Stderr.html'
|
||
title='bitflags::__core::io::Stderr'>Stderr</a></td>
|
||
<td class='docblock short'>
|
||
<p>A handle to the standard error stream of a process.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.StderrLock.html'
|
||
title='bitflags::__core::io::StderrLock'>StderrLock</a></td>
|
||
<td class='docblock short'>
|
||
<p>A locked reference to the <code>Stderr</code> handle.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Stdin.html'
|
||
title='bitflags::__core::io::Stdin'>Stdin</a></td>
|
||
<td class='docblock short'>
|
||
<p>A handle to the standard input stream of a process.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.StdinLock.html'
|
||
title='bitflags::__core::io::StdinLock'>StdinLock</a></td>
|
||
<td class='docblock short'>
|
||
<p>A locked reference to the <code>Stdin</code> handle.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Stdout.html'
|
||
title='bitflags::__core::io::Stdout'>Stdout</a></td>
|
||
<td class='docblock short'>
|
||
<p>A handle to the global standard output stream of the current process.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.StdoutLock.html'
|
||
title='bitflags::__core::io::StdoutLock'>StdoutLock</a></td>
|
||
<td class='docblock short'>
|
||
<p>A locked reference to the <code>Stdout</code> handle.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='struct' href='struct.Take.html'
|
||
title='bitflags::__core::io::Take'>Take</a></td>
|
||
<td class='docblock short'>
|
||
<p>Reader adaptor which limits the bytes read from an underlying reader.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class='unstable module-item'>
|
||
<td><a class='struct' href='struct.Chars.html'
|
||
title='bitflags::__core::io::Chars'>Chars</a></td>
|
||
<td class='docblock short'>
|
||
[<em class='stab unstable'>Unstable</em>] <p>An iterator over the <code>char</code>s of a reader.</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.ErrorKind.html'
|
||
title='bitflags::__core::io::ErrorKind'>ErrorKind</a></td>
|
||
<td class='docblock short'>
|
||
<p>A list specifying general categories of I/O error.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='enum' href='enum.SeekFrom.html'
|
||
title='bitflags::__core::io::SeekFrom'>SeekFrom</a></td>
|
||
<td class='docblock short'>
|
||
<p>Enumeration of possible methods to seek within an I/O object.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class='unstable module-item'>
|
||
<td><a class='enum' href='enum.CharsError.html'
|
||
title='bitflags::__core::io::CharsError'>CharsError</a></td>
|
||
<td class='docblock short'>
|
||
[<em class='stab unstable'>Unstable</em>] <p>An enumeration of possible errors that can be generated from the <code>Chars</code>
|
||
adapter.</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.BufRead.html'
|
||
title='bitflags::__core::io::BufRead'>BufRead</a></td>
|
||
<td class='docblock short'>
|
||
<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>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='trait' href='trait.Read.html'
|
||
title='bitflags::__core::io::Read'>Read</a></td>
|
||
<td class='docblock short'>
|
||
<p>The <code>Read</code> trait allows for reading bytes from a source.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='trait' href='trait.Seek.html'
|
||
title='bitflags::__core::io::Seek'>Seek</a></td>
|
||
<td class='docblock short'>
|
||
<p>The <code>Seek</code> trait provides a cursor which can be moved within a stream of
|
||
bytes.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='trait' href='trait.Write.html'
|
||
title='bitflags::__core::io::Write'>Write</a></td>
|
||
<td class='docblock short'>
|
||
<p>A trait for objects which are byte-oriented sinks.</p>
|
||
</td>
|
||
</tr></table><h2 id='functions-1' class='section-header'><a href="#functions-1">Functions</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class='fn' href='fn.copy.html'
|
||
title='bitflags::__core::io::copy'>copy</a></td>
|
||
<td class='docblock short'>
|
||
<p>Copies the entire contents of a reader into a writer.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='fn' href='fn.empty.html'
|
||
title='bitflags::__core::io::empty'>empty</a></td>
|
||
<td class='docblock short'>
|
||
<p>Constructs a new handle to an empty reader.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='fn' href='fn.repeat.html'
|
||
title='bitflags::__core::io::repeat'>repeat</a></td>
|
||
<td class='docblock short'>
|
||
<p>Creates an instance of a reader that infinitely repeats one byte.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='fn' href='fn.sink.html'
|
||
title='bitflags::__core::io::sink'>sink</a></td>
|
||
<td class='docblock short'>
|
||
<p>Creates an instance of a writer which will successfully consume all data.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='fn' href='fn.stderr.html'
|
||
title='bitflags::__core::io::stderr'>stderr</a></td>
|
||
<td class='docblock short'>
|
||
<p>Constructs a new handle to the standard error of the current process.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='fn' href='fn.stdin.html'
|
||
title='bitflags::__core::io::stdin'>stdin</a></td>
|
||
<td class='docblock short'>
|
||
<p>Constructs a new handle to the standard input of the current process.</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class='fn' href='fn.stdout.html'
|
||
title='bitflags::__core::io::stdout'>stdout</a></td>
|
||
<td class='docblock short'>
|
||
<p>Constructs a new handle to the standard output of the current process.</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='bitflags::__core::io::Result'>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>?</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> |