19 lines
18 KiB
HTML
19 lines
18 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_util::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="futures_util" 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="../../futures_util/index.html">futures_<wbr>util</a><span class="version">0.3.32</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module io</a></h2><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="#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 futures_<wbr>util</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">futures_util</a></div><h1>Module <span>io</span> <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/futures_util/io/mod.rs.html#1-833">Source</a> </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_util::io::AsyncRead"><code>AsyncRead</code></a>, <a href="trait.AsyncWrite.html" title="trait futures_util::io::AsyncWrite"><code>AsyncWrite</code></a>, <a href="trait.AsyncSeek.html" title="trait futures_util::io::AsyncSeek"><code>AsyncSeek</code></a>, and <a href="trait.AsyncBufRead.html" title="trait futures_util::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_util::io::AsyncReadExt"><code>AsyncReadExt</code></a>, <a href="trait.AsyncWriteExt.html" title="trait futures_util::io::AsyncWriteExt"><code>AsyncWriteExt</code></a>, <a href="trait.AsyncSeekExt.html" title="trait futures_util::io::AsyncSeekExt"><code>AsyncSeekExt</code></a>, and
|
||
<a href="trait.AsyncBufReadExt.html" title="trait futures_util::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="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.IoSlice"><code>pub use std::io::<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>;</code></dt><dt id="reexport.IoSliceMut"><code>pub use std::io::<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.IoSliceMut.html" title="struct std::io::IoSliceMut">IoSliceMut</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="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.AllowStdIo.html" title="struct futures_util::io::AllowStdIo">Allow<wbr>StdIo</a></dt><dd>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>.</dd><dt><a class="struct" href="struct.BufReader.html" title="struct futures_util::io::BufReader">BufReader</a></dt><dd>The <code>BufReader</code> struct adds buffering to any reader.</dd><dt><a class="struct" href="struct.BufWriter.html" title="struct futures_util::io::BufWriter">BufWriter</a></dt><dd>Wraps a writer and buffers its output.</dd><dt><a class="struct" href="struct.Chain.html" title="struct futures_util::io::Chain">Chain</a></dt><dd>Reader for the <a href="trait.AsyncReadExt.html#method.chain" title="method futures_util::io::AsyncReadExt::chain"><code>chain</code></a> method.</dd><dt><a class="struct" href="struct.Close.html" title="struct futures_util::io::Close">Close</a></dt><dd>Future for the <a href="trait.AsyncWriteExt.html#method.close" title="method futures_util::io::AsyncWriteExt::close"><code>close</code></a> method.</dd><dt><a class="struct" href="struct.Copy.html" title="struct futures_util::io::Copy">Copy</a></dt><dd>Future for the <a href="fn.copy.html" title="fn futures_util::io::copy"><code>copy()</code></a> function.</dd><dt><a class="struct" href="struct.CopyBuf.html" title="struct futures_util::io::CopyBuf">CopyBuf</a></dt><dd>Future for the <a href="fn.copy_buf.html" title="fn futures_util::io::copy_buf"><code>copy_buf()</code></a> function.</dd><dt><a class="struct" href="struct.CopyBufAbortable.html" title="struct futures_util::io::CopyBufAbortable">Copy<wbr>BufAbortable</a></dt><dd>Future for the <a href="fn.copy_buf_abortable.html" title="fn futures_util::io::copy_buf_abortable"><code>copy_buf_abortable()</code></a> function.</dd><dt><a class="struct" href="struct.Cursor.html" title="struct futures_util::io::Cursor">Cursor</a></dt><dd>A <code>Cursor</code> wraps an in-memory buffer and provides it with a
|
||
<a href="trait.AsyncSeek.html"><code>AsyncSeek</code></a> implementation.</dd><dt><a class="struct" href="struct.Empty.html" title="struct futures_util::io::Empty">Empty</a></dt><dd>Reader for the <a href="fn.empty.html" title="fn futures_util::io::empty"><code>empty()</code></a> function.</dd><dt><a class="struct" href="struct.FillBuf.html" title="struct futures_util::io::FillBuf">FillBuf</a></dt><dd>Future for the <a href="trait.AsyncBufReadExt.html#method.fill_buf" title="method futures_util::io::AsyncBufReadExt::fill_buf"><code>fill_buf</code></a> method.</dd><dt><a class="struct" href="struct.Flush.html" title="struct futures_util::io::Flush">Flush</a></dt><dd>Future for the <a href="trait.AsyncWriteExt.html#method.flush" title="method futures_util::io::AsyncWriteExt::flush"><code>flush</code></a> method.</dd><dt><a class="struct" href="struct.IntoSink.html" title="struct futures_util::io::IntoSink">Into<wbr>Sink</a></dt><dd>Sink for the <a href="trait.AsyncWriteExt.html#method.into_sink" title="method futures_util::io::AsyncWriteExt::into_sink"><code>into_sink</code></a> method.</dd><dt><a class="struct" href="struct.LineWriter.html" title="struct futures_util::io::LineWriter">Line<wbr>Writer</a></dt><dd>Wrap a writer, like <a href="struct.BufWriter.html" title="struct futures_util::io::BufWriter"><code>BufWriter</code></a> does, but prioritizes buffering lines</dd><dt><a class="struct" href="struct.Lines.html" title="struct futures_util::io::Lines">Lines</a></dt><dd>Stream for the <a href="trait.AsyncBufReadExt.html#method.lines" title="method futures_util::io::AsyncBufReadExt::lines"><code>lines</code></a> method.</dd><dt><a class="struct" href="struct.Read.html" title="struct futures_util::io::Read">Read</a></dt><dd>Future for the <a href="trait.AsyncReadExt.html#method.read" title="method futures_util::io::AsyncReadExt::read"><code>read</code></a> method.</dd><dt><a class="struct" href="struct.ReadExact.html" title="struct futures_util::io::ReadExact">Read<wbr>Exact</a></dt><dd>Future for the <a href="trait.AsyncReadExt.html#method.read_exact" title="method futures_util::io::AsyncReadExt::read_exact"><code>read_exact</code></a> method.</dd><dt><a class="struct" href="struct.ReadHalf.html" title="struct futures_util::io::ReadHalf">Read<wbr>Half</a></dt><dd>The readable half of an object returned from <code>AsyncRead::split</code>.</dd><dt><a class="struct" href="struct.ReadLine.html" title="struct futures_util::io::ReadLine">Read<wbr>Line</a></dt><dd>Future for the <a href="trait.AsyncBufReadExt.html#method.read_line" title="method futures_util::io::AsyncBufReadExt::read_line"><code>read_line</code></a> method.</dd><dt><a class="struct" href="struct.ReadToEnd.html" title="struct futures_util::io::ReadToEnd">Read<wbr>ToEnd</a></dt><dd>Future for the <a href="trait.AsyncReadExt.html#method.read_to_end" title="method futures_util::io::AsyncReadExt::read_to_end"><code>read_to_end</code></a> method.</dd><dt><a class="struct" href="struct.ReadToString.html" title="struct futures_util::io::ReadToString">Read<wbr>ToString</a></dt><dd>Future for the <a href="trait.AsyncReadExt.html#method.read_to_string" title="method futures_util::io::AsyncReadExt::read_to_string"><code>read_to_string</code></a> method.</dd><dt><a class="struct" href="struct.ReadUntil.html" title="struct futures_util::io::ReadUntil">Read<wbr>Until</a></dt><dd>Future for the <a href="trait.AsyncBufReadExt.html#method.read_until" title="method futures_util::io::AsyncBufReadExt::read_until"><code>read_until</code></a> method.</dd><dt><a class="struct" href="struct.ReadVectored.html" title="struct futures_util::io::ReadVectored">Read<wbr>Vectored</a></dt><dd>Future for the <a href="trait.AsyncReadExt.html#method.read_vectored" title="method futures_util::io::AsyncReadExt::read_vectored"><code>read_vectored</code></a> method.</dd><dt><a class="struct" href="struct.Repeat.html" title="struct futures_util::io::Repeat">Repeat</a></dt><dd>Reader for the <a href="fn.repeat.html" title="fn futures_util::io::repeat"><code>repeat()</code></a> function.</dd><dt><a class="struct" href="struct.ReuniteError.html" title="struct futures_util::io::ReuniteError">Reunite<wbr>Error</a></dt><dd>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.</dd><dt><a class="struct" href="struct.SeeKRelative.html" title="struct futures_util::io::SeeKRelative">SeeK<wbr>Relative</a></dt><dd>Future for the <a href="struct.BufReader.html#method.seek_relative" title="method futures_util::io::BufReader::seek_relative"><code>BufReader::seek_relative</code></a> method.</dd><dt><a class="struct" href="struct.Seek.html" title="struct futures_util::io::Seek">Seek</a></dt><dd>Future for the <a href="trait.AsyncSeekExt.html#method.seek" title="method futures_util::io::AsyncSeekExt::seek"><code>seek</code></a> method.</dd><dt><a class="struct" href="struct.Sink.html" title="struct futures_util::io::Sink">Sink</a></dt><dd>Writer for the <a href="fn.sink.html" title="fn futures_util::io::sink"><code>sink()</code></a> function.</dd><dt><a class="struct" href="struct.Take.html" title="struct futures_util::io::Take">Take</a></dt><dd>Reader for the <a href="trait.AsyncReadExt.html#method.take" title="method futures_util::io::AsyncReadExt::take"><code>take</code></a> method.</dd><dt><a class="struct" href="struct.Window.html" title="struct futures_util::io::Window">Window</a></dt><dd>An owned window around an underlying buffer.</dd><dt><a class="struct" href="struct.Write.html" title="struct futures_util::io::Write">Write</a></dt><dd>Future for the <a href="trait.AsyncWriteExt.html#method.write" title="method futures_util::io::AsyncWriteExt::write"><code>write</code></a> method.</dd><dt><a class="struct" href="struct.WriteAll.html" title="struct futures_util::io::WriteAll">Write<wbr>All</a></dt><dd>Future for the <a href="trait.AsyncWriteExt.html#method.write_all" title="method futures_util::io::AsyncWriteExt::write_all"><code>write_all</code></a> method.</dd><dt><a class="struct" href="struct.WriteHalf.html" title="struct futures_util::io::WriteHalf">Write<wbr>Half</a></dt><dd>The writable half of an object returned from <code>AsyncRead::split</code>.</dd><dt><a class="struct" href="struct.WriteVectored.html" title="struct futures_util::io::WriteVectored">Write<wbr>Vectored</a></dt><dd>Future for the <a href="trait.AsyncWriteExt.html#method.write_vectored" title="method futures_util::io::AsyncWriteExt::write_vectored"><code>write_vectored</code></a> method.</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 futures_util::io::AsyncBufRead">Async<wbr>BufRead</a></dt><dd>Read bytes asynchronously.</dd><dt><a class="trait" href="trait.AsyncBufReadExt.html" title="trait futures_util::io::AsyncBufReadExt">Async<wbr>BufRead<wbr>Ext</a></dt><dd>An extension trait which adds utility methods to <code>AsyncBufRead</code> types.</dd><dt><a class="trait" href="trait.AsyncRead.html" title="trait futures_util::io::AsyncRead">Async<wbr>Read</a></dt><dd>Read bytes asynchronously.</dd><dt><a class="trait" href="trait.AsyncReadExt.html" title="trait futures_util::io::AsyncReadExt">Async<wbr>Read<wbr>Ext</a></dt><dd>An extension trait which adds utility methods to <code>AsyncRead</code> types.</dd><dt><a class="trait" href="trait.AsyncSeek.html" title="trait futures_util::io::AsyncSeek">Async<wbr>Seek</a></dt><dd>Seek bytes asynchronously.</dd><dt><a class="trait" href="trait.AsyncSeekExt.html" title="trait futures_util::io::AsyncSeekExt">Async<wbr>Seek<wbr>Ext</a></dt><dd>An extension trait which adds utility methods to <code>AsyncSeek</code> types.</dd><dt><a class="trait" href="trait.AsyncWrite.html" title="trait futures_util::io::AsyncWrite">Async<wbr>Write</a></dt><dd>Write bytes asynchronously.</dd><dt><a class="trait" href="trait.AsyncWriteExt.html" title="trait futures_util::io::AsyncWriteExt">Async<wbr>Write<wbr>Ext</a></dt><dd>An extension trait which adds utility methods to <code>AsyncWrite</code> types.</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 futures_util::io::copy">copy</a></dt><dd>Creates a future which copies all the bytes from one object to another.</dd><dt><a class="fn" href="fn.copy_buf.html" title="fn futures_util::io::copy_buf">copy_<wbr>buf</a></dt><dd>Creates a future which copies all the bytes from one object to another.</dd><dt><a class="fn" href="fn.copy_buf_abortable.html" title="fn futures_util::io::copy_buf_abortable">copy_<wbr>buf_<wbr>abortable</a></dt><dd>Creates a future which copies all the bytes from one object to another, with its <code>AbortHandle</code>.</dd><dt><a class="fn" href="fn.empty.html" title="fn futures_util::io::empty">empty</a></dt><dd>Constructs a new handle to an empty reader.</dd><dt><a class="fn" href="fn.repeat.html" title="fn futures_util::io::repeat">repeat</a></dt><dd>Creates an instance of a reader that infinitely repeats one byte.</dd><dt><a class="fn" href="fn.sink.html" title="fn futures_util::io::sink">sink</a></dt><dd>Creates an instance of a writer which will successfully consume all data.</dd></dl></section></div></main></body></html> |