Files
google-apis-rs/futures/io/index.html
2021-04-02 00:20:57 +08:00

79 lines
19 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="API documentation for the Rust `io` mod in crate `futures`."><meta name="keywords" content="rust, rustlang, rust-lang, io"><title>futures::io - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../futures/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module io</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></div><p class="location"><a href="../index.html">futures</a></p><div id="sidebar-vars" data-name="io" data-ty="mod" data-relpath="../"></div><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">futures</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">&#x2212;</span>]</a></span><a class="srclink" href="../../src/futures_util/lib.rs.html#336" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Asynchronous I/O.</p>
<p>This module is the asynchronous version of <code>std::io</code>. It defines four
traits, <a href="../../futures/io/trait.AsyncRead.html" title="AsyncRead"><code>AsyncRead</code></a>, <a href="../../futures/io/trait.AsyncWrite.html" title="AsyncWrite"><code>AsyncWrite</code></a>, <a href="../../futures/io/trait.AsyncSeek.html" title="AsyncSeek"><code>AsyncSeek</code></a>, and <a href="../../futures/io/trait.AsyncBufRead.html" title="AsyncBufRead"><code>AsyncBufRead</code></a>,
which mirror the <code>Read</code>, <code>Write</code>, <code>Seek</code>, and <code>BufRead</code> traits of the
standard library. However, these traits integrate with the asynchronous
task system, so that if an I/O object isn't ready for reading (or writing),
the thread is not blocked, and instead the current task is queued to be
woken when I/O is ready.</p>
<p>In addition, the <a href="../../futures/io/trait.AsyncReadExt.html" title="AsyncReadExt"><code>AsyncReadExt</code></a>, <a href="../../futures/io/trait.AsyncWriteExt.html" title="AsyncWriteExt"><code>AsyncWriteExt</code></a>, <a href="../../futures/io/trait.AsyncSeekExt.html" title="AsyncSeekExt"><code>AsyncSeekExt</code></a>, and
<a href="../../futures/io/trait.AsyncBufReadExt.html" title="AsyncBufReadExt"><code>AsyncBufReadExt</code></a> extension traits offer a variety of useful combinators
for operating with asynchronous I/O objects, including ways to work with
them using futures, streams and sinks.</p>
<p>This module is only available when the <code>std</code> feature of this
library is activated, and it is activated by default.</p>
</div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
<table><tr class="module-item"><td><a class="struct" href="struct.AllowStdIo.html" title="futures::io::AllowStdIo struct">AllowStdIo</a></td><td class="docblock-short"><p>A simple wrapper type which allows types which implement only
implement <code>std::io::Read</code> or <code>std::io::Write</code>
to be used in contexts which expect an <code>AsyncRead</code> or <code>AsyncWrite</code>.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.BufReader.html" title="futures::io::BufReader struct">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="futures::io::BufWriter struct">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.Chain.html" title="futures::io::Chain struct">Chain</a></td><td class="docblock-short"><p>Reader for the <a href="../../futures/io/trait.AsyncReadExt.html#method.chain"><code>chain</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Close.html" title="futures::io::Close struct">Close</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncWriteExt.html#method.close"><code>close</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Copy.html" title="futures::io::Copy struct">Copy</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/fn.copy.html" title="copy()"><code>copy()</code></a> function.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.CopyBuf.html" title="futures::io::CopyBuf struct">CopyBuf</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/fn.copy_buf.html" title="copy_buf()"><code>copy_buf()</code></a> function.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Cursor.html" title="futures::io::Cursor struct">Cursor</a></td><td class="docblock-short"><p>A <code>Cursor</code> wraps an in-memory buffer and provides it with a
<a href="trait.AsyncSeek.html"><code>AsyncSeek</code></a> implementation.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Empty.html" title="futures::io::Empty struct">Empty</a></td><td class="docblock-short"><p>Reader for the <a href="../../futures/io/fn.empty.html" title="empty()"><code>empty()</code></a> function.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Error.html" title="futures::io::Error struct">Error</a></td><td class="docblock-short"><p>The error type for I/O operations of the <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html"><code>Read</code></a>, <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html"><code>Write</code></a>, <a href="https://doc.rust-lang.org/nightly/std/io/trait.Seek.html"><code>Seek</code></a>, and
associated traits.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.FillBuf.html" title="futures::io::FillBuf struct">FillBuf</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncBufReadExt.html#method.fill_buf"><code>fill_buf</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Flush.html" title="futures::io::Flush struct">Flush</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncWriteExt.html#method.flush"><code>flush</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.IntoSink.html" title="futures::io::IntoSink struct">IntoSink</a></td><td class="docblock-short"><p>Sink for the <a href="../../futures/io/trait.AsyncWriteExt.html#method.into_sink"><code>into_sink</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.IoSlice.html" title="futures::io::IoSlice struct">IoSlice</a></td><td class="docblock-short"><p>A buffer type used with <code>Write::write_vectored</code>.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.IoSliceMut.html" title="futures::io::IoSliceMut struct">IoSliceMut</a></td><td class="docblock-short"><p>A buffer type used with <code>Read::read_vectored</code>.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Lines.html" title="futures::io::Lines struct">Lines</a></td><td class="docblock-short"><p>Stream for the <a href="../../futures/io/trait.AsyncBufReadExt.html#method.lines"><code>lines</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Read.html" title="futures::io::Read struct">Read</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncReadExt.html#method.read"><code>read</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ReadExact.html" title="futures::io::ReadExact struct">ReadExact</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncReadExt.html#method.read_exact"><code>read_exact</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ReadHalf.html" title="futures::io::ReadHalf struct">ReadHalf</a></td><td class="docblock-short"><p>The readable half of an object returned from <code>AsyncRead::split</code>.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ReadLine.html" title="futures::io::ReadLine struct">ReadLine</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncBufReadExt.html#method.read_line"><code>read_line</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ReadToEnd.html" title="futures::io::ReadToEnd struct">ReadToEnd</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncReadExt.html#method.read_to_end"><code>read_to_end</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ReadToString.html" title="futures::io::ReadToString struct">ReadToString</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncReadExt.html#method.read_to_string"><code>read_to_string</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ReadUntil.html" title="futures::io::ReadUntil struct">ReadUntil</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncBufReadExt.html#method.read_until"><code>read_until</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ReadVectored.html" title="futures::io::ReadVectored struct">ReadVectored</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncReadExt.html#method.read_vectored"><code>read_vectored</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Repeat.html" title="futures::io::Repeat struct">Repeat</a></td><td class="docblock-short"><p>Reader for the <a href="../../futures/io/fn.repeat.html" title="repeat()"><code>repeat()</code></a> function.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ReuniteError.html" title="futures::io::ReuniteError struct">ReuniteError</a></td><td class="docblock-short"><p>Error indicating a <code>ReadHalf&lt;T&gt;</code> and <code>WriteHalf&lt;T&gt;</code> were not two halves
of a <code>AsyncRead + AsyncWrite</code>, and thus could not be <code>reunite</code>d.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Seek.html" title="futures::io::Seek struct">Seek</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncSeekExt.html#method.seek"><code>seek</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Sink.html" title="futures::io::Sink struct">Sink</a></td><td class="docblock-short"><p>Writer for the <a href="../../futures/io/fn.sink.html" title="sink()"><code>sink()</code></a> function.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Take.html" title="futures::io::Take struct">Take</a></td><td class="docblock-short"><p>Reader for the <a href="../../futures/io/trait.AsyncReadExt.html#method.take"><code>take</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Window.html" title="futures::io::Window struct">Window</a></td><td class="docblock-short"><p>A owned window around an underlying buffer.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Write.html" title="futures::io::Write struct">Write</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncWriteExt.html#method.write"><code>write</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.WriteAll.html" title="futures::io::WriteAll struct">WriteAll</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncWriteExt.html#method.write_all"><code>write_all</code></a> method.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.WriteHalf.html" title="futures::io::WriteHalf struct">WriteHalf</a></td><td class="docblock-short"><p>The writable half of an object returned from <code>AsyncRead::split</code>.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.WriteVectored.html" title="futures::io::WriteVectored struct">WriteVectored</a></td><td class="docblock-short"><p>Future for the <a href="../../futures/io/trait.AsyncWriteExt.html#method.write_vectored"><code>write_vectored</code></a> method.</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="futures::io::ErrorKind enum">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="futures::io::SeekFrom enum">SeekFrom</a></td><td class="docblock-short"><p>Enumeration of possible methods to seek within an I/O object.</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.AsyncBufRead.html" title="futures::io::AsyncBufRead trait">AsyncBufRead</a></td><td class="docblock-short"><p>Read bytes asynchronously.</p>
</td></tr><tr class="module-item"><td><a class="trait" href="trait.AsyncBufReadExt.html" title="futures::io::AsyncBufReadExt trait">AsyncBufReadExt</a></td><td class="docblock-short"><p>An extension trait which adds utility methods to <code>AsyncBufRead</code> types.</p>
</td></tr><tr class="module-item"><td><a class="trait" href="trait.AsyncRead.html" title="futures::io::AsyncRead trait">AsyncRead</a></td><td class="docblock-short"><p>Read bytes asynchronously.</p>
</td></tr><tr class="module-item"><td><a class="trait" href="trait.AsyncReadExt.html" title="futures::io::AsyncReadExt trait">AsyncReadExt</a></td><td class="docblock-short"><p>An extension trait which adds utility methods to <code>AsyncRead</code> types.</p>
</td></tr><tr class="module-item"><td><a class="trait" href="trait.AsyncSeek.html" title="futures::io::AsyncSeek trait">AsyncSeek</a></td><td class="docblock-short"><p>Seek bytes asynchronously.</p>
</td></tr><tr class="module-item"><td><a class="trait" href="trait.AsyncSeekExt.html" title="futures::io::AsyncSeekExt trait">AsyncSeekExt</a></td><td class="docblock-short"><p>An extension trait which adds utility methods to <code>AsyncSeek</code> types.</p>
</td></tr><tr class="module-item"><td><a class="trait" href="trait.AsyncWrite.html" title="futures::io::AsyncWrite trait">AsyncWrite</a></td><td class="docblock-short"><p>Write bytes asynchronously.</p>
</td></tr><tr class="module-item"><td><a class="trait" href="trait.AsyncWriteExt.html" title="futures::io::AsyncWriteExt trait">AsyncWriteExt</a></td><td class="docblock-short"><p>An extension trait which adds utility methods to <code>AsyncWrite</code> types.</p>
</td></tr></table><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2>
<table><tr class="module-item"><td><a class="fn" href="fn.copy.html" title="futures::io::copy fn">copy</a></td><td class="docblock-short"><p>Creates a future which copies all the bytes from one object to another.</p>
</td></tr><tr class="module-item"><td><a class="fn" href="fn.copy_buf.html" title="futures::io::copy_buf fn">copy_buf</a></td><td class="docblock-short"><p>Creates a future which copies all the bytes from one object to another.</p>
</td></tr><tr class="module-item"><td><a class="fn" href="fn.empty.html" title="futures::io::empty fn">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="futures::io::repeat fn">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="futures::io::sink fn">sink</a></td><td class="docblock-short"><p>Creates an instance of a writer which will successfully consume all data.</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="futures::io::Result type">Result</a></td><td class="docblock-short"><p>A specialized <a href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"><code>Result</code></a> type for I/O operations.</p>
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="futures"></div>
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>