mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
21 lines
21 KiB
HTML
21 lines
21 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="Asynchronous I/O."><title>futures::io - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="futures" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../futures/index.html">futures</a><span class="version">0.3.28</span></h2></div><h2 class="location"><a href="#">Module io</a></h2><div class="sidebar-elems"><section><ul class="block"><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 Aliases</a></li></ul></section><h2><a href="../index.html">In crate futures</a></h2></div></nav><div class="sidebar-resizer"></div>
|
||
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../futures/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">futures</a>::<wbr><a class="mod" href="#">io</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/futures_util/lib.rs.html#320">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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="trait.AsyncRead.html" title="trait futures::io::AsyncRead"><code>AsyncRead</code></a>, <a href="trait.AsyncWrite.html" title="trait futures::io::AsyncWrite"><code>AsyncWrite</code></a>, <a href="trait.AsyncSeek.html" title="trait futures::io::AsyncSeek"><code>AsyncSeek</code></a>, and <a href="trait.AsyncBufRead.html" title="trait futures::io::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="trait.AsyncReadExt.html" title="trait futures::io::AsyncReadExt"><code>AsyncReadExt</code></a>, <a href="trait.AsyncWriteExt.html" title="trait futures::io::AsyncWriteExt"><code>AsyncWriteExt</code></a>, <a href="trait.AsyncSeekExt.html" title="trait futures::io::AsyncSeekExt"><code>AsyncSeekExt</code></a>, and
|
||
<a href="trait.AsyncBufReadExt.html" title="trait futures::io::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></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.AllowStdIo.html" title="struct futures::io::AllowStdIo">AllowStdIo</a></div><div class="desc docblock-short">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>.</div></li><li><div class="item-name"><a class="struct" href="struct.BufReader.html" title="struct futures::io::BufReader">BufReader</a></div><div class="desc docblock-short">The <code>BufReader</code> struct adds buffering to any reader.</div></li><li><div class="item-name"><a class="struct" href="struct.BufWriter.html" title="struct futures::io::BufWriter">BufWriter</a></div><div class="desc docblock-short">Wraps a writer and buffers its output.</div></li><li><div class="item-name"><a class="struct" href="struct.Chain.html" title="struct futures::io::Chain">Chain</a></div><div class="desc docblock-short">Reader for the <a href="trait.AsyncReadExt.html#method.chain" title="method futures::io::AsyncReadExt::chain"><code>chain</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Close.html" title="struct futures::io::Close">Close</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncWriteExt.html#method.close" title="method futures::io::AsyncWriteExt::close"><code>close</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Copy.html" title="struct futures::io::Copy">Copy</a></div><div class="desc docblock-short">Future for the <a href="fn.copy.html" title="fn futures::io::copy"><code>copy()</code></a> function.</div></li><li><div class="item-name"><a class="struct" href="struct.CopyBuf.html" title="struct futures::io::CopyBuf">CopyBuf</a></div><div class="desc docblock-short">Future for the <a href="fn.copy_buf.html" title="fn futures::io::copy_buf"><code>copy_buf()</code></a> function.</div></li><li><div class="item-name"><a class="struct" href="struct.CopyBufAbortable.html" title="struct futures::io::CopyBufAbortable">CopyBufAbortable</a></div><div class="desc docblock-short">Future for the [<code>copy_buf()</code>] function.</div></li><li><div class="item-name"><a class="struct" href="struct.Cursor.html" title="struct futures::io::Cursor">Cursor</a></div><div class="desc docblock-short">A <code>Cursor</code> wraps an in-memory buffer and provides it with a
|
||
<a href="trait.AsyncSeek.html"><code>AsyncSeek</code></a> implementation.</div></li><li><div class="item-name"><a class="struct" href="struct.Empty.html" title="struct futures::io::Empty">Empty</a></div><div class="desc docblock-short">Reader for the <a href="fn.empty.html" title="fn futures::io::empty"><code>empty()</code></a> function.</div></li><li><div class="item-name"><a class="struct" href="struct.Error.html" title="struct futures::io::Error">Error</a></div><div class="desc docblock-short">The error type for I/O operations of the <a href="https://doc.rust-lang.org/1.76.0/std/io/trait.Read.html" title="trait std::io::Read"><code>Read</code></a>, <a href="https://doc.rust-lang.org/1.76.0/std/io/trait.Write.html" title="trait std::io::Write"><code>Write</code></a>, <a href="https://doc.rust-lang.org/1.76.0/std/io/trait.Seek.html" title="trait std::io::Seek"><code>Seek</code></a>, and
|
||
associated traits.</div></li><li><div class="item-name"><a class="struct" href="struct.FillBuf.html" title="struct futures::io::FillBuf">FillBuf</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncBufReadExt.html#method.fill_buf" title="method futures::io::AsyncBufReadExt::fill_buf"><code>fill_buf</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Flush.html" title="struct futures::io::Flush">Flush</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncWriteExt.html#method.flush" title="method futures::io::AsyncWriteExt::flush"><code>flush</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.IntoSink.html" title="struct futures::io::IntoSink">IntoSink</a></div><div class="desc docblock-short">Sink for the <a href="trait.AsyncWriteExt.html#method.into_sink" title="method futures::io::AsyncWriteExt::into_sink"><code>into_sink</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.IoSlice.html" title="struct futures::io::IoSlice">IoSlice</a></div><div class="desc docblock-short">A buffer type used with <code>Write::write_vectored</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.IoSliceMut.html" title="struct futures::io::IoSliceMut">IoSliceMut</a></div><div class="desc docblock-short">A buffer type used with <code>Read::read_vectored</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.LineWriter.html" title="struct futures::io::LineWriter">LineWriter</a></div><div class="desc docblock-short">Wrap a writer, like <a href="struct.BufWriter.html" title="struct futures::io::BufWriter"><code>BufWriter</code></a> does, but prioritizes buffering lines</div></li><li><div class="item-name"><a class="struct" href="struct.Lines.html" title="struct futures::io::Lines">Lines</a></div><div class="desc docblock-short">Stream for the <a href="trait.AsyncBufReadExt.html#method.lines" title="method futures::io::AsyncBufReadExt::lines"><code>lines</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Read.html" title="struct futures::io::Read">Read</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncReadExt.html#method.read" title="method futures::io::AsyncReadExt::read"><code>read</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.ReadExact.html" title="struct futures::io::ReadExact">ReadExact</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncReadExt.html#method.read_exact" title="method futures::io::AsyncReadExt::read_exact"><code>read_exact</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.ReadHalf.html" title="struct futures::io::ReadHalf">ReadHalf</a></div><div class="desc docblock-short">The readable half of an object returned from <code>AsyncRead::split</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.ReadLine.html" title="struct futures::io::ReadLine">ReadLine</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncBufReadExt.html#method.read_line" title="method futures::io::AsyncBufReadExt::read_line"><code>read_line</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.ReadToEnd.html" title="struct futures::io::ReadToEnd">ReadToEnd</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncReadExt.html#method.read_to_end" title="method futures::io::AsyncReadExt::read_to_end"><code>read_to_end</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.ReadToString.html" title="struct futures::io::ReadToString">ReadToString</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncReadExt.html#method.read_to_string" title="method futures::io::AsyncReadExt::read_to_string"><code>read_to_string</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.ReadUntil.html" title="struct futures::io::ReadUntil">ReadUntil</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncBufReadExt.html#method.read_until" title="method futures::io::AsyncBufReadExt::read_until"><code>read_until</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.ReadVectored.html" title="struct futures::io::ReadVectored">ReadVectored</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncReadExt.html#method.read_vectored" title="method futures::io::AsyncReadExt::read_vectored"><code>read_vectored</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Repeat.html" title="struct futures::io::Repeat">Repeat</a></div><div class="desc docblock-short">Reader for the <a href="fn.repeat.html" title="fn futures::io::repeat"><code>repeat()</code></a> function.</div></li><li><div class="item-name"><a class="struct" href="struct.ReuniteError.html" title="struct futures::io::ReuniteError">ReuniteError</a></div><div class="desc docblock-short">Error indicating a <code>ReadHalf<T></code> and <code>WriteHalf<T></code> were not two halves
|
||
of a <code>AsyncRead + AsyncWrite</code>, and thus could not be <code>reunite</code>d.</div></li><li><div class="item-name"><a class="struct" href="struct.SeeKRelative.html" title="struct futures::io::SeeKRelative">SeeKRelative</a></div><div class="desc docblock-short">Future for the <a href="struct.BufReader.html#method.seek_relative" title="method futures::io::BufReader::seek_relative"><code>BufReader::seek_relative</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Seek.html" title="struct futures::io::Seek">Seek</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncSeekExt.html#method.seek" title="method futures::io::AsyncSeekExt::seek"><code>seek</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Sink.html" title="struct futures::io::Sink">Sink</a></div><div class="desc docblock-short">Writer for the <a href="fn.sink.html" title="fn futures::io::sink"><code>sink()</code></a> function.</div></li><li><div class="item-name"><a class="struct" href="struct.Take.html" title="struct futures::io::Take">Take</a></div><div class="desc docblock-short">Reader for the <a href="trait.AsyncReadExt.html#method.take" title="method futures::io::AsyncReadExt::take"><code>take</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Window.html" title="struct futures::io::Window">Window</a></div><div class="desc docblock-short">A owned window around an underlying buffer.</div></li><li><div class="item-name"><a class="struct" href="struct.Write.html" title="struct futures::io::Write">Write</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncWriteExt.html#method.write" title="method futures::io::AsyncWriteExt::write"><code>write</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.WriteAll.html" title="struct futures::io::WriteAll">WriteAll</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncWriteExt.html#method.write_all" title="method futures::io::AsyncWriteExt::write_all"><code>write_all</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.WriteHalf.html" title="struct futures::io::WriteHalf">WriteHalf</a></div><div class="desc docblock-short">The writable half of an object returned from <code>AsyncRead::split</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.WriteVectored.html" title="struct futures::io::WriteVectored">WriteVectored</a></div><div class="desc docblock-short">Future for the <a href="trait.AsyncWriteExt.html#method.write_vectored" title="method futures::io::AsyncWriteExt::write_vectored"><code>write_vectored</code></a> method.</div></li></ul><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.ErrorKind.html" title="enum futures::io::ErrorKind">ErrorKind</a></div><div class="desc docblock-short">A list specifying general categories of I/O error.</div></li><li><div class="item-name"><a class="enum" href="enum.SeekFrom.html" title="enum futures::io::SeekFrom">SeekFrom</a></div><div class="desc docblock-short">Enumeration of possible methods to seek within an I/O object.</div></li></ul><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.AsyncBufRead.html" title="trait futures::io::AsyncBufRead">AsyncBufRead</a></div><div class="desc docblock-short">Read bytes asynchronously.</div></li><li><div class="item-name"><a class="trait" href="trait.AsyncBufReadExt.html" title="trait futures::io::AsyncBufReadExt">AsyncBufReadExt</a></div><div class="desc docblock-short">An extension trait which adds utility methods to <code>AsyncBufRead</code> types.</div></li><li><div class="item-name"><a class="trait" href="trait.AsyncRead.html" title="trait futures::io::AsyncRead">AsyncRead</a></div><div class="desc docblock-short">Read bytes asynchronously.</div></li><li><div class="item-name"><a class="trait" href="trait.AsyncReadExt.html" title="trait futures::io::AsyncReadExt">AsyncReadExt</a></div><div class="desc docblock-short">An extension trait which adds utility methods to <code>AsyncRead</code> types.</div></li><li><div class="item-name"><a class="trait" href="trait.AsyncSeek.html" title="trait futures::io::AsyncSeek">AsyncSeek</a></div><div class="desc docblock-short">Seek bytes asynchronously.</div></li><li><div class="item-name"><a class="trait" href="trait.AsyncSeekExt.html" title="trait futures::io::AsyncSeekExt">AsyncSeekExt</a></div><div class="desc docblock-short">An extension trait which adds utility methods to <code>AsyncSeek</code> types.</div></li><li><div class="item-name"><a class="trait" href="trait.AsyncWrite.html" title="trait futures::io::AsyncWrite">AsyncWrite</a></div><div class="desc docblock-short">Write bytes asynchronously.</div></li><li><div class="item-name"><a class="trait" href="trait.AsyncWriteExt.html" title="trait futures::io::AsyncWriteExt">AsyncWriteExt</a></div><div class="desc docblock-short">An extension trait which adds utility methods to <code>AsyncWrite</code> types.</div></li></ul><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.copy.html" title="fn futures::io::copy">copy</a></div><div class="desc docblock-short">Creates a future which copies all the bytes from one object to another.</div></li><li><div class="item-name"><a class="fn" href="fn.copy_buf.html" title="fn futures::io::copy_buf">copy_buf</a></div><div class="desc docblock-short">Creates a future which copies all the bytes from one object to another.</div></li><li><div class="item-name"><a class="fn" href="fn.copy_buf_abortable.html" title="fn futures::io::copy_buf_abortable">copy_buf_abortable</a></div><div class="desc docblock-short">Creates a future which copies all the bytes from one object to another, with its <code>AbortHandle</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.empty.html" title="fn futures::io::empty">empty</a></div><div class="desc docblock-short">Constructs a new handle to an empty reader.</div></li><li><div class="item-name"><a class="fn" href="fn.repeat.html" title="fn futures::io::repeat">repeat</a></div><div class="desc docblock-short">Creates an instance of a reader that infinitely repeats one byte.</div></li><li><div class="item-name"><a class="fn" href="fn.sink.html" title="fn futures::io::sink">sink</a></div><div class="desc docblock-short">Creates an instance of a writer which will successfully consume all data.</div></li></ul><h2 id="types" class="section-header"><a href="#types">Type Aliases</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.Result.html" title="type futures::io::Result">Result</a></div><div class="desc docblock-short">A specialized <a href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result"><code>Result</code></a> type for I/O operations.</div></li></ul></section></div></main></body></html> |