Files
GopherGate/target/doc/tokio/io/index.html
2026-02-26 12:00:21 -05:00

126 lines
27 KiB
HTML
Raw 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="Traits, helpers, and type definitions for asynchronous I/O functionality."><title>tokio::io - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="tokio" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module io</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../tokio/index.html">tokio</a><span class="version">1.49.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module io</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#asyncread-and-asyncwrite" title="`AsyncRead` and `AsyncWrite`"><code>AsyncRead</code> and <code>AsyncWrite</code></a><ul><li><a href="#buffered-readers-and-writers" title="Buffered Readers and Writers">Buffered Readers and Writers</a></li><li><a href="#implementing-asyncread-and-asyncwrite" title="Implementing `AsyncRead` and `AsyncWrite`">Implementing <code>AsyncRead</code> and <code>AsyncWrite</code></a></li><li><a href="#conversion-to-and-from-streamsink" title="Conversion to and from Stream/Sink">Conversion to and from Stream/Sink</a></li></ul></li><li><a href="#standard-input-and-output" title="Standard input and output">Standard input and output</a></li><li><a href="#std-re-exports" title="`std` re-exports"><code>std</code> re-exports</a></li></ul><h3><a href="#reexports">Module Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate tokio</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">tokio</a></div><h1>Module <span>io</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/tokio/io/mod.rs.html#1-308">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Traits, helpers, and type definitions for asynchronous I/O functionality.</p>
<p>This module is the asynchronous version of <code>std::io</code>. Primarily, it
defines two traits, <a href="trait.AsyncRead.html" title="trait tokio::io::AsyncRead"><code>AsyncRead</code></a> and <a href="trait.AsyncWrite.html" title="trait tokio::io::AsyncWrite"><code>AsyncWrite</code></a>, which are asynchronous
versions of the <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html" title="trait std::io::Read"><code>Read</code></a> and <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html" title="trait std::io::Write"><code>Write</code></a> traits in the standard library.</p>
<h2 id="asyncread-and-asyncwrite"><a class="doc-anchor" href="#asyncread-and-asyncwrite">§</a><code>AsyncRead</code> and <code>AsyncWrite</code></h2>
<p>Like the standard librarys <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html" title="trait std::io::Read"><code>Read</code></a> and <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html" title="trait std::io::Write"><code>Write</code></a> traits, <a href="trait.AsyncRead.html" title="trait tokio::io::AsyncRead"><code>AsyncRead</code></a> and
<a href="trait.AsyncWrite.html" title="trait tokio::io::AsyncWrite"><code>AsyncWrite</code></a> provide the most general interface for reading and writing
input and output. Unlike the standard librarys traits, however, they are
<em>asynchronous</em> — meaning that reading from or writing to a <code>tokio::io</code>
type will <em>yield</em> to the Tokio scheduler when IO is not ready, rather than
blocking. This allows other tasks to run while waiting on IO.</p>
<p>Another difference is that <code>AsyncRead</code> and <code>AsyncWrite</code> only contain
core methods needed to provide asynchronous reading and writing
functionality. Instead, utility methods are defined in the <a href="trait.AsyncReadExt.html" title="trait tokio::io::AsyncReadExt"><code>AsyncReadExt</code></a>
and <a href="trait.AsyncWriteExt.html" title="trait tokio::io::AsyncWriteExt"><code>AsyncWriteExt</code></a> extension traits. These traits are automatically
implemented for all values that implement <code>AsyncRead</code> and <code>AsyncWrite</code>
respectively.</p>
<p>End users will rarely interact directly with <code>AsyncRead</code> and
<code>AsyncWrite</code>. Instead, they will use the async functions defined in the
extension traits. Library authors are expected to implement <code>AsyncRead</code>
and <code>AsyncWrite</code> in order to provide types that behave like byte streams.</p>
<p>Even with these differences, Tokios <code>AsyncRead</code> and <code>AsyncWrite</code> traits
can be used in almost exactly the same manner as the standard librarys
<code>Read</code> and <code>Write</code>. Most types in the standard library that implement <code>Read</code>
and <code>Write</code> have asynchronous equivalents in <code>tokio</code> that implement
<code>AsyncRead</code> and <code>AsyncWrite</code>, such as <a href="../fs/struct.File.html" title="struct tokio::fs::File"><code>File</code></a> and <a href="../net/struct.TcpStream.html" title="struct tokio::net::TcpStream"><code>TcpStream</code></a>.</p>
<p>For example, the standard library documentation introduces <code>Read</code> by
<a href="https://doc.rust-lang.org/1.93.1/std/io/index.html#read-and-write" title="mod std::io">demonstrating</a> reading some bytes from a <a href="https://doc.rust-lang.org/1.93.1/std/fs/struct.File.html" title="struct std::fs::File"><code>std::fs::File</code></a>. We
can do the same with <a href="../fs/struct.File.html" title="struct tokio::fs::File"><code>tokio::fs::File</code></a>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::io::{<span class="self">self</span>, AsyncReadExt};
<span class="kw">use </span>tokio::fs::File;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>f = File::open(<span class="string">"foo.txt"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>buffer = [<span class="number">0</span>; <span class="number">10</span>];
<span class="comment">// read up to 10 bytes
</span><span class="kw">let </span>n = f.read(<span class="kw-2">&amp;mut </span>buffer).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">println!</span>(<span class="string">"The bytes: {:?}"</span>, <span class="kw-2">&amp;</span>buffer[..n]);
<span class="prelude-val">Ok</span>(())
}</code></pre></div><h3 id="buffered-readers-and-writers"><a class="doc-anchor" href="#buffered-readers-and-writers">§</a>Buffered Readers and Writers</h3>
<p>Byte-based interfaces are unwieldy and can be inefficient, as wed need to be
making near-constant calls to the operating system. To help with this,
<code>std::io</code> comes with <a href="https://doc.rust-lang.org/1.93.1/std/io/index.html#bufreader-and-bufwriter" title="mod std::io">support for <em>buffered</em> readers and writers</a>,
and therefore, <code>tokio::io</code> does as well.</p>
<p>Tokio provides an async version of the <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html" title="trait std::io::BufRead"><code>std::io::BufRead</code></a> trait,
<a href="trait.AsyncBufRead.html" title="trait tokio::io::AsyncBufRead"><code>AsyncBufRead</code></a>; and async <a href="struct.BufReader.html" title="struct tokio::io::BufReader"><code>BufReader</code></a> and <a href="struct.BufWriter.html" title="struct tokio::io::BufWriter"><code>BufWriter</code></a> structs, which
wrap readers and writers. These wrappers use a buffer, reducing the number
of calls and providing nicer methods for accessing exactly what you want.</p>
<p>For example, <a href="struct.BufReader.html" title="struct tokio::io::BufReader"><code>BufReader</code></a> works with the <a href="trait.AsyncBufRead.html" title="trait tokio::io::AsyncBufRead"><code>AsyncBufRead</code></a> trait to add
extra methods to any async reader:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::io::{<span class="self">self</span>, BufReader, AsyncBufReadExt};
<span class="kw">use </span>tokio::fs::File;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>f = File::open(<span class="string">"foo.txt"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>reader = BufReader::new(f);
<span class="kw">let </span><span class="kw-2">mut </span>buffer = String::new();
<span class="comment">// read a line into buffer
</span>reader.read_line(<span class="kw-2">&amp;mut </span>buffer).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">println!</span>(<span class="string">"{}"</span>, buffer);
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
<p><a href="struct.BufWriter.html" title="struct tokio::io::BufWriter"><code>BufWriter</code></a> doesnt add any new ways of writing; it just buffers every call
to <a href="trait.AsyncWriteExt.html#method.write" title="method tokio::io::AsyncWriteExt::write"><code>write</code></a>. However, you <strong>must</strong> flush
<a href="struct.BufWriter.html" title="struct tokio::io::BufWriter"><code>BufWriter</code></a> to ensure that any buffered data is written.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::io::{<span class="self">self</span>, BufWriter, AsyncWriteExt};
<span class="kw">use </span>tokio::fs::File;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>f = File::create(<span class="string">"foo.txt"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
{
<span class="kw">let </span><span class="kw-2">mut </span>writer = BufWriter::new(f);
<span class="comment">// Write a byte to the buffer.
</span>writer.write(<span class="kw-2">&amp;</span>[<span class="number">42u8</span>]).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="comment">// Flush the buffer before it goes out of scope.
</span>writer.flush().<span class="kw">await</span><span class="question-mark">?</span>;
} <span class="comment">// Unless flushed or shut down, the contents of the buffer is discarded on drop.
</span><span class="prelude-val">Ok</span>(())
}</code></pre></div><h3 id="implementing-asyncread-and-asyncwrite"><a class="doc-anchor" href="#implementing-asyncread-and-asyncwrite">§</a>Implementing <code>AsyncRead</code> and <code>AsyncWrite</code></h3>
<p>Because they are traits, we can implement <a href="trait.AsyncRead.html" title="trait tokio::io::AsyncRead"><code>AsyncRead</code></a> and <a href="trait.AsyncWrite.html" title="trait tokio::io::AsyncWrite"><code>AsyncWrite</code></a> for
our own types, as well. Note that these traits must only be implemented for
non-blocking I/O types that integrate with the futures type system. In
other words, these types must never block the thread, and instead the
current task is notified when the I/O resource is ready.</p>
<h3 id="conversion-to-and-from-streamsink"><a class="doc-anchor" href="#conversion-to-and-from-streamsink">§</a>Conversion to and from Stream/Sink</h3>
<p>It is often convenient to encapsulate the reading and writing of bytes in a
<a href="https://docs.rs/futures/0.3/futures/stream/trait.Stream.html"><code>Stream</code></a> or <a href="https://docs.rs/futures/0.3/futures/sink/trait.Sink.html"><code>Sink</code></a> of data.</p>
<p>Tokio provides simple wrappers for converting <a href="trait.AsyncRead.html" title="trait tokio::io::AsyncRead"><code>AsyncRead</code></a> to <a href="https://docs.rs/futures/0.3/futures/stream/trait.Stream.html"><code>Stream</code></a>
and vice-versa in the <a href="https://docs.rs/tokio-util">tokio-util</a> crate, see <a href="https://docs.rs/tokio-util/latest/tokio_util/io/struct.ReaderStream.html"><code>ReaderStream</code></a> and
<a href="https://docs.rs/tokio-util/latest/tokio_util/io/struct.StreamReader.html"><code>StreamReader</code></a>.</p>
<p>There are also utility traits that abstract the asynchronous buffering
necessary to write your own adaptors for encoding and decoding bytes to/from
your structured data, allowing to transform something that implements
<a href="trait.AsyncRead.html" title="trait tokio::io::AsyncRead"><code>AsyncRead</code></a>/<a href="trait.AsyncWrite.html" title="trait tokio::io::AsyncWrite"><code>AsyncWrite</code></a> into a <a href="https://docs.rs/futures/0.3/futures/stream/trait.Stream.html"><code>Stream</code></a>/<a href="https://docs.rs/futures/0.3/futures/sink/trait.Sink.html"><code>Sink</code></a>, see <a href="https://docs.rs/tokio-util/latest/tokio_util/codec/trait.Decoder.html"><code>Decoder</code></a> and
<a href="https://docs.rs/tokio-util/latest/tokio_util/codec/trait.Encoder.html"><code>Encoder</code></a> in the <a href="https://docs.rs/tokio-util/latest/tokio_util/codec/index.html">tokio-util::codec</a> module.</p>
<h2 id="standard-input-and-output"><a class="doc-anchor" href="#standard-input-and-output">§</a>Standard input and output</h2>
<p>Tokio provides asynchronous APIs to standard <a href="fn.stdin.html" title="fn tokio::io::stdin">input</a>, <a href="fn.stdout.html" title="fn tokio::io::stdout">output</a>, and <a href="fn.stderr.html" title="fn tokio::io::stderr">error</a>.
These APIs are very similar to the ones provided by <code>std</code>, but they also
implement <a href="trait.AsyncRead.html" title="trait tokio::io::AsyncRead"><code>AsyncRead</code></a> and <a href="trait.AsyncWrite.html" title="trait tokio::io::AsyncWrite"><code>AsyncWrite</code></a>.</p>
<p>Note that the standard input / output APIs <strong>must</strong> be used from the
context of the Tokio runtime, as they require Tokio-specific features to
function. Calling these functions outside of a Tokio runtime will panic.</p>
<h2 id="std-re-exports"><a class="doc-anchor" href="#std-re-exports">§</a><code>std</code> re-exports</h2>
<p>Additionally, <a href="https://doc.rust-lang.org/1.93.1/std/io/error/struct.Error.html" title="struct std::io::error::Error"><code>Error</code></a>, <a href="https://doc.rust-lang.org/1.93.1/std/io/error/enum.ErrorKind.html" title="enum std::io::error::ErrorKind"><code>ErrorKind</code></a>, <a href="https://doc.rust-lang.org/1.93.1/std/io/error/type.Result.html" title="type std::io::error::Result"><code>Result</code></a>, and <a href="https://doc.rust-lang.org/1.93.1/std/io/enum.SeekFrom.html" title="enum std::io::SeekFrom"><code>SeekFrom</code></a> are
re-exported from <code>std::io</code> for ease of use.</p>
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><dl class="item-table reexports"><dt id="reexport.Error"><code>pub use std::io::<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>;</code></dt><dt id="reexport.ErrorKind"><code>pub use std::io::<a class="enum" href="https://doc.rust-lang.org/1.93.1/std/io/error/enum.ErrorKind.html" title="enum std::io::error::ErrorKind">ErrorKind</a>;</code></dt><dt id="reexport.Result"><code>pub use std::io::<a class="type" href="https://doc.rust-lang.org/1.93.1/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>;</code></dt><dt id="reexport.SeekFrom"><code>pub use std::io::<a class="enum" href="https://doc.rust-lang.org/1.93.1/std/io/enum.SeekFrom.html" title="enum std::io::SeekFrom">SeekFrom</a>;</code></dt></dl><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="unix/index.html" title="mod tokio::io::unix">unix</a></dt><dd>Asynchronous IO structures specific to Unix-like operating systems.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BufReader.html" title="struct tokio::io::BufReader">BufReader</a></dt><dd>The <code>BufReader</code> struct adds buffering to any reader.</dd><dt><a class="struct" href="struct.BufStream.html" title="struct tokio::io::BufStream">BufStream</a></dt><dd>Wraps a type that is <a href="trait.AsyncWrite.html" title="trait tokio::io::AsyncWrite"><code>AsyncWrite</code></a> and <a href="trait.AsyncRead.html" title="trait tokio::io::AsyncRead"><code>AsyncRead</code></a>, and buffers its input and output.</dd><dt><a class="struct" href="struct.BufWriter.html" title="struct tokio::io::BufWriter">BufWriter</a></dt><dd>Wraps a writer and buffers its output.</dd><dt><a class="struct" href="struct.Chain.html" title="struct tokio::io::Chain">Chain</a></dt><dd>Stream for the <a href="trait.AsyncReadExt.html#method.chain" title="method tokio::io::AsyncReadExt::chain"><code>chain</code></a> method.</dd><dt><a class="struct" href="struct.DuplexStream.html" title="struct tokio::io::DuplexStream">Duplex<wbr>Stream</a></dt><dd>A bidirectional pipe to read and write bytes in memory.</dd><dt><a class="struct" href="struct.Empty.html" title="struct tokio::io::Empty">Empty</a></dt><dd><code>Empty</code> ignores any data written via <a href="trait.AsyncWrite.html" title="trait tokio::io::AsyncWrite"><code>AsyncWrite</code></a>, and will always be empty
(returning zero bytes) when read via <a href="trait.AsyncRead.html" title="trait tokio::io::AsyncRead"><code>AsyncRead</code></a>.</dd><dt><a class="struct" href="struct.Interest.html" title="struct tokio::io::Interest">Interest</a></dt><dd>Readiness event interest.</dd><dt><a class="struct" href="struct.Join.html" title="struct tokio::io::Join">Join</a></dt><dd>Joins two values implementing <code>AsyncRead</code> and <code>AsyncWrite</code> into a
single handle.</dd><dt><a class="struct" href="struct.Lines.html" title="struct tokio::io::Lines">Lines</a></dt><dd>Reads lines from an <a href="trait.AsyncBufRead.html" title="trait tokio::io::AsyncBufRead"><code>AsyncBufRead</code></a>.</dd><dt><a class="struct" href="struct.ReadBuf.html" title="struct tokio::io::ReadBuf">ReadBuf</a></dt><dd>A wrapper around a byte buffer that is incrementally filled and initialized.</dd><dt><a class="struct" href="struct.ReadHalf.html" title="struct tokio::io::ReadHalf">Read<wbr>Half</a></dt><dd>The readable half of a value returned from <a href="fn.split.html" title="fn tokio::io::split"><code>split</code></a>.</dd><dt><a class="struct" href="struct.Ready.html" title="struct tokio::io::Ready">Ready</a></dt><dd>Describes the readiness state of an I/O resources.</dd><dt><a class="struct" href="struct.Repeat.html" title="struct tokio::io::Repeat">Repeat</a></dt><dd>An async reader which yields one byte over and over and over and over and
over and…</dd><dt><a class="struct" href="struct.SimplexStream.html" title="struct tokio::io::SimplexStream">Simplex<wbr>Stream</a></dt><dd>A unidirectional pipe to read and write bytes in memory.</dd><dt><a class="struct" href="struct.Sink.html" title="struct tokio::io::Sink">Sink</a></dt><dd>An async writer which will move data into the void.</dd><dt><a class="struct" href="struct.Split.html" title="struct tokio::io::Split">Split</a></dt><dd>Splitter for the <a href="trait.AsyncBufReadExt.html#method.split" title="method tokio::io::AsyncBufReadExt::split"><code>split</code></a> method.</dd><dt><a class="struct" href="struct.Stderr.html" title="struct tokio::io::Stderr">Stderr</a></dt><dd>A handle to the standard error stream of a process.</dd><dt><a class="struct" href="struct.Stdin.html" title="struct tokio::io::Stdin">Stdin</a></dt><dd>A handle to the standard input stream of a process.</dd><dt><a class="struct" href="struct.Stdout.html" title="struct tokio::io::Stdout">Stdout</a></dt><dd>A handle to the standard output stream of a process.</dd><dt><a class="struct" href="struct.Take.html" title="struct tokio::io::Take">Take</a></dt><dd>Stream for the <a href="trait.AsyncReadExt.html#method.take" title="method tokio::io::AsyncReadExt::take"><code>take</code></a> method.</dd><dt><a class="struct" href="struct.WriteHalf.html" title="struct tokio::io::WriteHalf">Write<wbr>Half</a></dt><dd>The writable half of a value returned from <a href="fn.split.html" title="fn tokio::io::split"><code>split</code></a>.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.AsyncBufRead.html" title="trait tokio::io::AsyncBufRead">Async<wbr>BufRead</a></dt><dd>Reads bytes asynchronously.</dd><dt><a class="trait" href="trait.AsyncBufReadExt.html" title="trait tokio::io::AsyncBufReadExt">Async<wbr>BufRead<wbr>Ext</a></dt><dd>An extension trait which adds utility methods to <a href="trait.AsyncBufRead.html" title="trait tokio::io::AsyncBufRead"><code>AsyncBufRead</code></a> types.</dd><dt><a class="trait" href="trait.AsyncRead.html" title="trait tokio::io::AsyncRead">Async<wbr>Read</a></dt><dd>Reads bytes from a source.</dd><dt><a class="trait" href="trait.AsyncReadExt.html" title="trait tokio::io::AsyncReadExt">Async<wbr>Read<wbr>Ext</a></dt><dd>Reads bytes from a source.</dd><dt><a class="trait" href="trait.AsyncSeek.html" title="trait tokio::io::AsyncSeek">Async<wbr>Seek</a></dt><dd>Seek bytes asynchronously.</dd><dt><a class="trait" href="trait.AsyncSeekExt.html" title="trait tokio::io::AsyncSeekExt">Async<wbr>Seek<wbr>Ext</a></dt><dd>An extension trait that adds utility methods to <a href="trait.AsyncSeek.html" title="trait tokio::io::AsyncSeek"><code>AsyncSeek</code></a> types.</dd><dt><a class="trait" href="trait.AsyncWrite.html" title="trait tokio::io::AsyncWrite">Async<wbr>Write</a></dt><dd>Writes bytes asynchronously.</dd><dt><a class="trait" href="trait.AsyncWriteExt.html" title="trait tokio::io::AsyncWriteExt">Async<wbr>Write<wbr>Ext</a></dt><dd>Writes bytes to a sink.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.copy.html" title="fn tokio::io::copy">copy</a></dt><dd>Asynchronously copies the entire contents of a reader into a writer.</dd><dt><a class="fn" href="fn.copy_bidirectional.html" title="fn tokio::io::copy_bidirectional">copy_<wbr>bidirectional</a></dt><dd>Copies data in both directions between <code>a</code> and <code>b</code>.</dd><dt><a class="fn" href="fn.copy_bidirectional_with_sizes.html" title="fn tokio::io::copy_bidirectional_with_sizes">copy_<wbr>bidirectional_<wbr>with_<wbr>sizes</a></dt><dd>Copies data in both directions between <code>a</code> and <code>b</code> using buffers of the specified size.</dd><dt><a class="fn" href="fn.copy_buf.html" title="fn tokio::io::copy_buf">copy_<wbr>buf</a></dt><dd>Asynchronously copies the entire contents of a reader into a writer.</dd><dt><a class="fn" href="fn.duplex.html" title="fn tokio::io::duplex">duplex</a></dt><dd>Create a new pair of <code>DuplexStream</code>s that act like a pair of connected sockets.</dd><dt><a class="fn" href="fn.empty.html" title="fn tokio::io::empty">empty</a></dt><dd>Creates a value that is always at EOF for reads, and ignores all data written.</dd><dt><a class="fn" href="fn.join.html" title="fn tokio::io::join">join</a></dt><dd>Join two values implementing <code>AsyncRead</code> and <code>AsyncWrite</code> into a
single handle.</dd><dt><a class="fn" href="fn.repeat.html" title="fn tokio::io::repeat">repeat</a></dt><dd>Creates an instance of an async reader that infinitely repeats one byte.</dd><dt><a class="fn" href="fn.simplex.html" title="fn tokio::io::simplex">simplex</a></dt><dd>Creates unidirectional buffer that acts like in memory pipe.</dd><dt><a class="fn" href="fn.sink.html" title="fn tokio::io::sink">sink</a></dt><dd>Creates an instance of an async writer which will successfully consume all
data.</dd><dt><a class="fn" href="fn.split.html" title="fn tokio::io::split">split</a></dt><dd>Splits a single value implementing <code>AsyncRead + AsyncWrite</code> into separate
<code>AsyncRead</code> and <code>AsyncWrite</code> handles.</dd><dt><a class="fn" href="fn.stderr.html" title="fn tokio::io::stderr">stderr</a></dt><dd>Constructs a new handle to the standard error of the current process.</dd><dt><a class="fn" href="fn.stdin.html" title="fn tokio::io::stdin">stdin</a></dt><dd>Constructs a new handle to the standard input of the current process.</dd><dt><a class="fn" href="fn.stdout.html" title="fn tokio::io::stdout">stdout</a></dt><dd>Constructs a new handle to the standard output of the current process.</dd></dl></section></div></main></body></html>