258 lines
90 KiB
HTML
258 lines
90 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="Use a `tokio::io::AsyncRead` synchronously as a `std::io::Read` or a `tokio::io::AsyncWrite` synchronously as a `std::io::Write`."><title>SyncIoBridge in tokio_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="tokio_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 struct"><!--[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="#">SyncIoBridge</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../tokio_util/index.html">tokio_<wbr>util</a><span class="version">0.7.18</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Sync<wbr>IoBridge</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#alternatives" title="Alternatives">Alternatives</a><ul><li><a href="#why-it-matters" title="Why It Matters:">Why It Matters:</a></li><li><a href="#example-1-hashing-data" title="Example 1: Hashing Data">Example 1: Hashing Data</a></li><li><a href="#example-2-compressing-data" title="Example 2: Compressing Data">Example 2: Compressing Data</a></li><li><a href="#example-3-parsing-data-formats" title="Example 3: Parsing Data Formats">Example 3: Parsing Data Formats</a></li><li><a href="#correct-usage-of-synciobridge-inside-spawn_blocking" title="Correct Usage of `SyncIoBridge` inside `spawn_blocking`">Correct Usage of <code>SyncIoBridge</code> inside <code>spawn_blocking</code></a></li></ul></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.into_inner" title="into_inner">into_inner</a></li><li><a href="#method.is_write_vectored" title="is_write_vectored">is_write_vectored</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.new_with_handle" title="new_with_handle">new_with_handle</a></li><li><a href="#method.shutdown" title="shutdown">shutdown</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-AsMut%3CT%3E-for-SyncIoBridge%3CT%3E" title="AsMut<T>">AsMut<T></a></li><li><a href="#impl-AsRef%3CT%3E-for-SyncIoBridge%3CT%3E" title="AsRef<T>">AsRef<T></a></li><li><a href="#impl-BufRead-for-SyncIoBridge%3CT%3E" title="BufRead">BufRead</a></li><li><a href="#impl-Debug-for-SyncIoBridge%3CT%3E" title="Debug">Debug</a></li><li><a href="#impl-Read-for-SyncIoBridge%3CT%3E" title="Read">Read</a></li><li><a href="#impl-Seek-for-SyncIoBridge%3CT%3E" title="Seek">Seek</a></li><li><a href="#impl-Write-for-SyncIoBridge%3CT%3E" title="Write">Write</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-SyncIoBridge%3CT%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-SyncIoBridge%3CT%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-SyncIoBridge%3CT%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-SyncIoBridge%3CT%3E" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-SyncIoBridge%3CT%3E" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-SyncIoBridge%3CT%3E" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In tokio_<wbr>util::<wbr>io</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_util</a>::<wbr><a href="index.html">io</a></div><h1>Struct <span class="struct">Sync<wbr>IoBridge</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/tokio_util/io/sync_bridge.rs.html#264-267">Source</a> </span></div><pre class="rust item-decl"><code>pub struct SyncIoBridge<T> { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Use a <a href="../../tokio/io/async_read/trait.AsyncRead.html" title="trait tokio::io::async_read::AsyncRead"><code>tokio::io::AsyncRead</code></a> synchronously as a <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html" title="trait std::io::Read"><code>std::io::Read</code></a> or
|
||
a <a href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite"><code>tokio::io::AsyncWrite</code></a> synchronously as a <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html" title="trait std::io::Write"><code>std::io::Write</code></a>.</p>
|
||
<h2 id="alternatives"><a class="doc-anchor" href="#alternatives">§</a>Alternatives</h2>
|
||
<p>In many cases, there are better alternatives to using <code>SyncIoBridge</code>, especially
|
||
if you want to avoid blocking the async runtime. Consider the following scenarios:</p>
|
||
<p>When hashing data, using <code>SyncIoBridge</code> can lead to suboptimal performance and
|
||
might not fully leverage the async capabilities of the system.</p>
|
||
<h4 id="why-it-matters"><a class="doc-anchor" href="#why-it-matters">§</a>Why It Matters:</h4>
|
||
<p><code>SyncIoBridge</code> allows you to use asynchronous I/O operations in an synchronous
|
||
context by blocking the current thread. However, this can be inefficient because:</p>
|
||
<ul>
|
||
<li><strong>Inefficient Resource Usage</strong>: <code>SyncIoBridge</code> takes up an entire OS thread,
|
||
which is inefficient compared to asynchronous code that can multiplex many
|
||
tasks on a single thread.</li>
|
||
<li><strong>Thread Pool Saturation</strong>: Excessive use of <code>SyncIoBridge</code> can exhaust the
|
||
async runtime’s thread pool, reducing the number of threads available for
|
||
other tasks and impacting overall performance.</li>
|
||
<li><strong>Missed Concurrency Benefits</strong>: By using synchronous operations with
|
||
<code>SyncIoBridge</code>, you lose the ability to interleave tasks efficiently,
|
||
which is a key advantage of asynchronous programming.</li>
|
||
</ul>
|
||
<h3 id="example-1-hashing-data"><a class="doc-anchor" href="#example-1-hashing-data">§</a>Example 1: Hashing Data</h3>
|
||
<p>The use of <code>SyncIoBridge</code> is unnecessary when hashing data. Instead, you can
|
||
process the data asynchronously by reading it into memory, which avoids blocking
|
||
the async runtime.</p>
|
||
<p>There are two strategies for avoiding <code>SyncIoBridge</code> when hashing data. When
|
||
the data fits into memory, the easiest is to read the data into a <code>Vec<u8></code>
|
||
and hash it:</p>
|
||
<p>Explanation: This example demonstrates how to asynchronously read data from a
|
||
reader into memory and hash it using a synchronous hashing function. The
|
||
<code>SyncIoBridge</code> is avoided, ensuring that the async runtime is not blocked.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::io::AsyncReadExt;
|
||
<span class="kw">use </span>tokio::io::AsyncRead;
|
||
<span class="kw">use </span>std::io::Cursor;
|
||
|
||
<span class="kw">async fn </span>hash_contents(<span class="kw-2">mut </span>reader: <span class="kw">impl </span>AsyncRead + Unpin) -> <span class="prelude-ty">Result</span><(), std::io::Error> {
|
||
<span class="comment">// Read all data from the reader into a Vec<u8>.
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>data = Vec::new();
|
||
reader.read_to_end(<span class="kw-2">&mut </span>data).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
|
||
<span class="comment">// Hash the data using the blake3 hashing function.
|
||
</span><span class="kw">let </span>hash = blake3::hash(<span class="kw-2">&</span>data);
|
||
|
||
<span class="prelude-val">Ok</span>(hash)
|
||
}
|
||
|
||
<span class="comment">// Example: In-memory data.
|
||
</span><span class="kw">let </span>data = <span class="string">b"Hello, world!"</span>; <span class="comment">// A byte slice.
|
||
</span><span class="kw">let </span>reader = Cursor::new(data); <span class="comment">// Create an in-memory AsyncRead.
|
||
</span>hash_contents(reader).<span class="kw">await</span></code></pre></div>
|
||
<p>When the data doesn’t fit into memory, the hashing library will usually
|
||
provide a <code>hasher</code> that you can repeatedly call <code>update</code> on to hash the data
|
||
one chunk at the time.</p>
|
||
<p>Explanation: This example demonstrates how to asynchronously stream data in
|
||
chunks for hashing. Each chunk is read asynchronously, and the hash is updated
|
||
incrementally. This avoids blocking and improves performance over using
|
||
<code>SyncIoBridge</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::io::AsyncReadExt;
|
||
<span class="kw">use </span>tokio::io::AsyncRead;
|
||
<span class="kw">use </span>std::io::Cursor;
|
||
|
||
<span class="doccomment">/// Asynchronously streams data from an async reader, processes it in chunks,
|
||
/// and hashes the data incrementally.
|
||
</span><span class="kw">async fn </span>hash_stream(<span class="kw-2">mut </span>reader: <span class="kw">impl </span>AsyncRead + Unpin, <span class="kw-2">mut </span>hasher: Hasher) -> <span class="prelude-ty">Result</span><(), std::io::Error> {
|
||
<span class="comment">// Create a buffer to read data into, sized for performance.
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>data = <span class="macro">vec!</span>[<span class="number">0</span>; <span class="number">16 </span>* <span class="number">1024</span>];
|
||
<span class="kw">loop </span>{
|
||
<span class="comment">// Read data from the reader into the buffer.
|
||
</span><span class="kw">let </span>len = reader.read(<span class="kw-2">&mut </span>data).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="kw">if </span>len == <span class="number">0 </span>{ <span class="kw">break</span>; } <span class="comment">// Exit loop if no more data.
|
||
|
||
// Update the hash with the data read.
|
||
</span>hasher.update(<span class="kw-2">&</span>data[..len]);
|
||
}
|
||
|
||
<span class="comment">// Finalize the hash after all data has been processed.
|
||
</span><span class="kw">let </span>hash = hasher.finalize();
|
||
|
||
<span class="prelude-val">Ok</span>(hash)
|
||
}
|
||
|
||
<span class="comment">// Example: In-memory data.
|
||
</span><span class="kw">let </span>data = <span class="string">b"Hello, world!"</span>; <span class="comment">// A byte slice.
|
||
</span><span class="kw">let </span>reader = Cursor::new(data); <span class="comment">// Create an in-memory AsyncRead.
|
||
</span><span class="kw">let </span>hasher = Hasher;
|
||
hash_stream(reader, hasher).<span class="kw">await</span></code></pre></div><h3 id="example-2-compressing-data"><a class="doc-anchor" href="#example-2-compressing-data">§</a>Example 2: Compressing Data</h3>
|
||
<p>When compressing data, the use of <code>SyncIoBridge</code> is unnecessary as it introduces
|
||
blocking and inefficient code. Instead, you can utilize an async compression library
|
||
such as the <a href="https://docs.rs/async-compression/latest/async_compression/"><code>async-compression</code></a>
|
||
crate, which is built to handle asynchronous data streams efficiently.</p>
|
||
<p>Explanation: This example shows how to asynchronously compress data using an
|
||
async compression library. By reading and writing asynchronously, it avoids
|
||
blocking and is more efficient than using <code>SyncIoBridge</code> with a non-async
|
||
compression library.</p>
|
||
|
||
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>async_compression::tokio::write::GzipEncoder;
|
||
<span class="kw">use </span>std::io::Cursor;
|
||
<span class="kw">use </span>tokio::io::AsyncRead;
|
||
|
||
<span class="doccomment">/// Asynchronously compresses data from an async reader using Gzip and an async encoder.
|
||
</span><span class="kw">async fn </span>compress_data(<span class="kw-2">mut </span>reader: <span class="kw">impl </span>AsyncRead + Unpin) -> <span class="prelude-ty">Result</span><(), std::io::Error> {
|
||
<span class="kw">let </span>writer = tokio::io::sink();
|
||
|
||
<span class="comment">// Create a Gzip encoder that wraps the writer.
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>encoder = GzipEncoder::new(writer);
|
||
|
||
<span class="comment">// Copy data from the reader to the encoder, compressing it.
|
||
</span>tokio::io::copy(<span class="kw-2">&mut </span>reader, <span class="kw-2">&mut </span>encoder).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}
|
||
|
||
<span class="attr">#[tokio::main]
|
||
</span><span class="kw">async fn </span>main() -> <span class="prelude-ty">Result</span><(), std::io::Error> {
|
||
<span class="comment">// Example: In-memory data.
|
||
</span><span class="kw">let </span>data = <span class="string">b"Hello, world!"</span>; <span class="comment">// A byte slice.
|
||
</span><span class="kw">let </span>reader = Cursor::new(data); <span class="comment">// Create an in-memory AsyncRead.
|
||
</span>compress_data(reader).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div><h3 id="example-3-parsing-data-formats"><a class="doc-anchor" href="#example-3-parsing-data-formats">§</a>Example 3: Parsing Data Formats</h3>
|
||
<p><code>SyncIoBridge</code> is not ideal when parsing data formats such as <code>JSON</code>, as it
|
||
blocks async operations. A more efficient approach is to read data asynchronously
|
||
into memory and then <code>deserialize</code> it, avoiding unnecessary synchronization overhead.</p>
|
||
<p>Explanation: This example shows how to asynchronously read data into memory
|
||
and then parse it as <code>JSON</code>. By avoiding <code>SyncIoBridge</code>, the asynchronous runtime
|
||
remains unblocked, leading to better performance when working with asynchronous
|
||
I/O streams.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::io::AsyncRead;
|
||
<span class="kw">use </span>tokio::io::AsyncReadExt;
|
||
<span class="kw">use </span>std::io::Cursor;
|
||
|
||
|
||
<span class="kw">async fn </span>parse_json(<span class="kw-2">mut </span>reader: <span class="kw">impl </span>AsyncRead + Unpin) -> <span class="prelude-ty">Result</span><MyStruct, std::io::Error> {
|
||
<span class="comment">// Read all data from the reader into a Vec<u8>.
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>data = Vec::new();
|
||
reader.read_to_end(<span class="kw-2">&mut </span>data).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
|
||
<span class="comment">// Deserialize the data from the Vec<u8> into a MyStruct instance.
|
||
</span><span class="kw">let </span>value: MyStruct = serde_json::from_slice(<span class="kw-2">&</span>data)<span class="question-mark">?</span>;
|
||
|
||
<span class="prelude-val">Ok</span>(value)
|
||
}
|
||
|
||
<span class="attr">#[tokio::main]
|
||
</span><span class="kw">async fn </span>main() -> <span class="prelude-ty">Result</span><(), std::io::Error> {
|
||
<span class="comment">// Example: In-memory data.
|
||
</span><span class="kw">let </span>data = <span class="string">b"Hello, world!"</span>; <span class="comment">// A byte slice.
|
||
</span><span class="kw">let </span>reader = Cursor::new(data); <span class="comment">// Create an in-memory AsyncRead.
|
||
</span>parse_json(reader).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
<span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div><h3 id="correct-usage-of-synciobridge-inside-spawn_blocking"><a class="doc-anchor" href="#correct-usage-of-synciobridge-inside-spawn_blocking">§</a>Correct Usage of <code>SyncIoBridge</code> inside <code>spawn_blocking</code></h3>
|
||
<p><code>SyncIoBridge</code> is mainly useful when you need to interface with synchronous
|
||
libraries from an asynchronous context.</p>
|
||
<p>Explanation: This example shows how to use <code>SyncIoBridge</code> inside a <code>spawn_blocking</code>
|
||
task to safely perform synchronous I/O without blocking the async runtime. The
|
||
<code>spawn_blocking</code> ensures that the synchronous code is offloaded to a dedicated
|
||
thread pool, preventing it from interfering with the async tasks.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::task::spawn_blocking;
|
||
<span class="kw">use </span>tokio_util::io::SyncIoBridge;
|
||
<span class="kw">use </span>tokio::io::AsyncRead;
|
||
<span class="kw">use </span>std::marker::Unpin;
|
||
<span class="kw">use </span>std::io::Cursor;
|
||
|
||
<span class="doccomment">/// Wraps an async reader with `SyncIoBridge` and performs synchronous I/O operations in a blocking task.
|
||
</span><span class="kw">async fn </span>process_sync_io(reader: <span class="kw">impl </span>AsyncRead + Unpin + Send + <span class="lifetime">'static</span>) -> <span class="prelude-ty">Result</span><Vec<u8>, std::io::Error> {
|
||
<span class="comment">// Wrap the async reader with `SyncIoBridge` to allow synchronous reading.
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>sync_reader = SyncIoBridge::new(reader);
|
||
|
||
<span class="comment">// Spawn a blocking task to perform synchronous I/O operations.
|
||
</span><span class="kw">let </span>result = spawn_blocking(<span class="kw">move </span>|| {
|
||
<span class="comment">// Create an in-memory buffer to hold the copied data.
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>buffer = Vec::new();
|
||
<span class="comment">// Copy data from the sync_reader to the buffer.
|
||
</span>std::io::copy(<span class="kw-2">&mut </span>sync_reader, <span class="kw-2">&mut </span>buffer)<span class="question-mark">?</span>;
|
||
<span class="comment">// Return the buffer containing the copied data.
|
||
</span><span class="prelude-val">Ok</span>::<<span class="kw">_</span>, std::io::Error>(buffer)
|
||
})
|
||
.<span class="kw">await</span><span class="question-mark">??</span>;
|
||
|
||
<span class="comment">// Return the result from the blocking task.
|
||
</span><span class="prelude-val">Ok</span>(result)
|
||
}
|
||
|
||
<span class="attr">#[tokio::main]
|
||
</span><span class="kw">async fn </span>main() -> <span class="prelude-ty">Result</span><(), std::io::Error> {
|
||
<span class="comment">// Example: In-memory data.
|
||
</span><span class="kw">let </span>data = <span class="string">b"Hello, world!"</span>; <span class="comment">// A byte slice.
|
||
</span><span class="kw">let </span>reader = Cursor::new(data); <span class="comment">// Create an in-memory AsyncRead.
|
||
</span><span class="kw">let </span>result = process_sync_io(reader).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
|
||
<span class="comment">// You can use `result` here as needed.
|
||
|
||
</span><span class="prelude-val">Ok</span>(())
|
||
}</code></pre></div></div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-SyncIoBridge%3CT%3E" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#346-353">Source</a><a href="#impl-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite">AsyncWrite</a>> <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.is_write_vectored" class="method"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#350-352">Source</a><h4 class="code-header">pub fn <a href="#method.is_write_vectored" class="fn">is_write_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Determines if the underlying <a href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite"><code>tokio::io::AsyncWrite</code></a> target supports efficient vectored writes.</p>
|
||
<p>See <a href="../../tokio/io/async_write/trait.AsyncWrite.html#method.is_write_vectored" title="method tokio::io::async_write::AsyncWrite::is_write_vectored"><code>tokio::io::AsyncWrite::is_write_vectored</code></a>.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-SyncIoBridge%3CT%3E-1" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#355-368">Source</a><a href="#impl-SyncIoBridge%3CT%3E-1" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite">AsyncWrite</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>> <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.shutdown" class="method"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#364-367">Source</a><h4 class="code-header">pub fn <a href="#method.shutdown" class="fn">shutdown</a>(&mut self) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>></h4></section></summary><div class="docblock"><p>Shutdown this writer. This method provides a way to call the <a href="../../tokio/io/util/async_write_ext/trait.AsyncWriteExt.html#method.shutdown" title="method tokio::io::util::async_write_ext::AsyncWriteExt::shutdown"><code>AsyncWriteExt::shutdown</code></a>
|
||
function of the inner <a href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite"><code>tokio::io::AsyncWrite</code></a> instance.</p>
|
||
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
||
<p>This method returns the same errors as <a href="../../tokio/io/util/async_write_ext/trait.AsyncWriteExt.html#method.shutdown" title="method tokio::io::util::async_write_ext::AsyncWriteExt::shutdown"><code>AsyncWriteExt::shutdown</code></a>.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-SyncIoBridge%3CT%3E-2" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#370-410">Source</a><a href="#impl-SyncIoBridge%3CT%3E-2" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>> <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#393-395">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(src: T) -> Self</h4></section></summary><div class="docblock"><p>Use a <a href="../../tokio/io/async_read/trait.AsyncRead.html" title="trait tokio::io::async_read::AsyncRead"><code>tokio::io::AsyncRead</code></a> synchronously as a <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html" title="trait std::io::Read"><code>std::io::Read</code></a> or
|
||
a <a href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite"><code>tokio::io::AsyncWrite</code></a> as a <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html" title="trait std::io::Write"><code>std::io::Write</code></a>.</p>
|
||
<p>When this struct is created, it captures a handle to the current thread’s runtime with <a href="../../tokio/runtime/handle/struct.Handle.html#method.current" title="associated function tokio::runtime::handle::Handle::current"><code>tokio::runtime::Handle::current</code></a>.
|
||
It is hence OK to move this struct into a separate thread outside the runtime, as created
|
||
by e.g. <a href="../../tokio/task/blocking/fn.spawn_blocking.html" title="fn tokio::task::blocking::spawn_blocking"><code>tokio::task::spawn_blocking</code></a>.</p>
|
||
<p>Stated even more strongly: to make use of this bridge, you <em>must</em> move
|
||
it into a separate thread outside the runtime. The synchronous I/O will use the
|
||
underlying handle to block on the backing asynchronous source, via
|
||
<a href="../../tokio/runtime/handle/struct.Handle.html#method.block_on" title="method tokio::runtime::handle::Handle::block_on"><code>tokio::runtime::Handle::block_on</code></a>. As noted in the documentation for that
|
||
function, an attempt to <code>block_on</code> from an asynchronous execution context
|
||
will panic.</p>
|
||
<h5 id="wrapping-unpin-types"><a class="doc-anchor" href="#wrapping-unpin-types">§</a>Wrapping <code>!Unpin</code> types</h5>
|
||
<p>Use e.g. <code>SyncIoBridge::new(Box::pin(src))</code>.</p>
|
||
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
|
||
<p>This will panic if called outside the context of a Tokio runtime.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_with_handle" class="method"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#402-404">Source</a><h4 class="code-header">pub fn <a href="#method.new_with_handle" class="fn">new_with_handle</a>(src: T, rt: <a class="struct" href="../../tokio/runtime/handle/struct.Handle.html" title="struct tokio::runtime::handle::Handle">Handle</a>) -> Self</h4></section></summary><div class="docblock"><p>Use a <a href="../../tokio/io/async_read/trait.AsyncRead.html" title="trait tokio::io::async_read::AsyncRead"><code>tokio::io::AsyncRead</code></a> synchronously as a <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html" title="trait std::io::Read"><code>std::io::Read</code></a> or
|
||
a <a href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite"><code>tokio::io::AsyncWrite</code></a> as a <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html" title="trait std::io::Write"><code>std::io::Write</code></a>.</p>
|
||
<p>This is the same as <a href="struct.SyncIoBridge.html#method.new" title="associated function tokio_util::io::SyncIoBridge::new"><code>SyncIoBridge::new</code></a>, but allows passing an arbitrary handle and hence may
|
||
be initially invoked outside of an asynchronous context.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_inner" class="method"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#407-409">Source</a><h4 class="code-header">pub fn <a href="#method.into_inner" class="fn">into_inner</a>(self) -> T</h4></section></summary><div class="docblock"><p>Consume this bridge, returning the underlying stream.</p>
|
||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-AsMut%3CT%3E-for-SyncIoBridge%3CT%3E" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#412-416">Source</a><a href="#impl-AsMut%3CT%3E-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><T> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_mut" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#413-415">Source</a><a href="#method.as_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsMut.html#tymethod.as_mut" class="fn">as_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Converts this type into a mutable reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CT%3E-for-SyncIoBridge%3CT%3E" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#418-422">Source</a><a href="#impl-AsRef%3CT%3E-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><T> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#419-421">Source</a><a href="#method.as_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-BufRead-for-SyncIoBridge%3CT%3E" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#269-289">Source</a><a href="#impl-BufRead-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="../../tokio/io/async_buf_read/trait.AsyncBufRead.html" title="trait tokio::io::async_buf_read::AsyncBufRead">AsyncBufRead</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html" title="trait std::io::BufRead">BufRead</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fill_buf" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#270-273">Source</a><a href="#method.fill_buf" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#tymethod.fill_buf" class="fn">fill_buf</a>(&mut self) -> <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><&[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]></h4></section></summary><div class='docblock'>Returns the contents of the internal buffer, filling it with more data, via <code>Read</code> methods, if empty. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#tymethod.fill_buf">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.consume" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#275-278">Source</a><a href="#method.consume" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#tymethod.consume" class="fn">consume</a>(&mut self, amt: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Marks the given <code>amount</code> of additional bytes from the internal buffer as having been read.
|
||
Subsequent calls to <code>read</code> only return bytes that have not been marked as read. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#tymethod.consume">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_until" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#280-284">Source</a><a href="#method.read_until" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.read_until" class="fn">read_until</a>(&mut self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>>) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class='docblock'>Reads all bytes into <code>buf</code> until the delimiter <code>byte</code> or EOF is reached. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.read_until">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_line" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#285-288">Source</a><a href="#method.read_line" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.read_line" class="fn">read_line</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class='docblock'>Reads all bytes until a newline (the <code>0xA</code> byte) is reached, and append
|
||
them to the provided <code>String</code> buffer. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.read_line">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.has_data_left" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#2435">Source</a><a href="#method.has_data_left" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.has_data_left" class="fn">has_data_left</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a>, <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>></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>buf_read_has_data_left</code>)</span></div></span><div class='docblock'>Checks if there is any data left to be <code>read</code>. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.has_data_left">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.skip_until" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.83.0">1.83.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#2559">Source</a></span><a href="#method.skip_until" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.skip_until" class="fn">skip_until</a>(&mut self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, <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>></h4></section></summary><div class='docblock'>Skips all bytes until the delimiter <code>byte</code> or EOF is reached. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.skip_until">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.split" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#2665-2667">Source</a></span><a href="#method.split" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.split" class="fn">split</a>(self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.Split.html" title="struct std::io::Split">Split</a><Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Returns an iterator over the contents of this reader split on the byte
|
||
<code>byte</code>. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.split">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lines" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#2702-2704">Source</a></span><a href="#method.lines" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.lines" class="fn">lines</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.Lines.html" title="struct std::io::Lines">Lines</a><Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Returns an iterator over the lines of this reader. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.BufRead.html#method.lines">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-SyncIoBridge%3CT%3E" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#263">Source</a><a href="#impl-Debug-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#263">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.93.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.93.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Read-for-SyncIoBridge%3CT%3E" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#291-313">Source</a><a href="#impl-Read-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="../../tokio/io/async_read/trait.AsyncRead.html" title="trait tokio::io::async_read::AsyncRead">AsyncRead</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.read" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#292-295">Source</a><a href="#method.read" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#tymethod.read" class="fn">read</a>(&mut self, buf: &mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class='docblock'>Pull some bytes from this source into the specified buffer, returning
|
||
how many bytes were read. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#tymethod.read">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_to_end" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#297-300">Source</a><a href="#method.read_to_end" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_to_end" class="fn">read_to_end</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>>) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class='docblock'>Reads all bytes until EOF in this source, placing them into <code>buf</code>. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_to_end">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_to_string" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#302-305">Source</a><a href="#method.read_to_string" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_to_string" class="fn">read_to_string</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class='docblock'>Reads all bytes until EOF in this source, appending them to <code>buf</code>. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_to_string">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_exact" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#307-312">Source</a><a href="#method.read_exact" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_exact" class="fn">read_exact</a>(&mut self, buf: &mut [<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>></h4></section></summary><div class='docblock'>Reads the exact number of bytes required to fill <code>buf</code>. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_exact">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_vectored" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#825">Source</a></span><a href="#method.read_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_vectored" class="fn">read_vectored</a>(&mut self, bufs: &mut [<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.IoSliceMut.html" title="struct std::io::IoSliceMut">IoSliceMut</a><'_>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>, <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>></h4></section></summary><div class='docblock'>Like <code>read</code>, except that it reads into a slice of buffers. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.is_read_vectored" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#838">Source</a><a href="#method.is_read_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.is_read_vectored" class="fn">is_read_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>can_vector</code>)</span></div></span><div class='docblock'>Determines if this <code>Read</code>er has an efficient <code>read_vectored</code>
|
||
implementation. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.is_read_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_buf" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1057">Source</a><a href="#method.read_buf" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_buf" class="fn">read_buf</a>(&mut self, buf: <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/io/borrowed_buf/struct.BorrowedCursor.html" title="struct core::io::borrowed_buf::BorrowedCursor">BorrowedCursor</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <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>></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>read_buf</code>)</span></div></span><div class='docblock'>Pull some bytes from this source into the specified buffer. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_buf">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_buf_exact" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1080">Source</a><a href="#method.read_buf_exact" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_buf_exact" class="fn">read_buf_exact</a>(&mut self, cursor: <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/io/borrowed_buf/struct.BorrowedCursor.html" title="struct core::io::borrowed_buf::BorrowedCursor">BorrowedCursor</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <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>></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>read_buf</code>)</span></div></span><div class='docblock'>Reads the exact number of bytes required to fill <code>cursor</code>. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_buf_exact">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.by_ref" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1119-1121">Source</a></span><a href="#method.by_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.by_ref" class="fn">by_ref</a>(&mut self) -> &mut Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates a “by reference” adapter for this instance of <code>Read</code>. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.by_ref">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.bytes" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1162-1164">Source</a></span><a href="#method.bytes" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.bytes" class="fn">bytes</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Transforms this <code>Read</code> instance to an <a href="https://doc.rust-lang.org/1.93.1/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator"><code>Iterator</code></a> over its bytes. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.bytes">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.chain" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1200-1202">Source</a></span><a href="#method.chain" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.chain" class="fn">chain</a><R>(self, next: R) -> <a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><Self, R><div class="where">where
|
||
R: <a class="trait" href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html" title="trait std::io::Read">Read</a>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates an adapter which will chain this stream with another. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.chain">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.take" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1239-1241">Source</a></span><a href="#method.take" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.take" class="fn">take</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.Take.html" title="struct std::io::Take">Take</a><Self><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates an adapter which will read at most <code>limit</code> bytes from it. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.take">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.read_array" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1274-1276">Source</a><a href="#method.read_array" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_array" class="fn">read_array</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>; <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.array.html">N</a>], <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>><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>read_array</code>)</span></div></span><div class='docblock'>Read and return a fixed array of bytes from this source. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Read.html#method.read_array">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Seek-for-SyncIoBridge%3CT%3E" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#337-342">Source</a><a href="#impl-Seek-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="../../tokio/io/async_seek/trait.AsyncSeek.html" title="trait tokio::io::async_seek::AsyncSeek">AsyncSeek</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html" title="trait std::io::Seek">Seek</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.seek" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#338-341">Source</a><a href="#method.seek" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#tymethod.seek" class="fn">seek</a>(&mut self, pos: <a class="enum" href="https://doc.rust-lang.org/1.93.1/std/io/enum.SeekFrom.html" title="enum std::io::SeekFrom">SeekFrom</a>) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>></h4></section></summary><div class='docblock'>Seek to an offset, in bytes, in a stream. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#tymethod.seek">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.rewind" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.55.0">1.55.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#2104">Source</a></span><a href="#method.rewind" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#method.rewind" class="fn">rewind</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <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>></h4></section></summary><div class='docblock'>Rewind to the beginning of a stream. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#method.rewind">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.stream_len" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#2144">Source</a><a href="#method.stream_len" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#method.stream_len" class="fn">stream_len</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, <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>></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>seek_stream_len</code>)</span></div></span><div class='docblock'>Returns the length of this stream (in bytes). <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#method.stream_len">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.stream_position" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#2172">Source</a></span><a href="#method.stream_position" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#method.stream_position" class="fn">stream_position</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u64.html">u64</a>, <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>></h4></section></summary><div class='docblock'>Returns the current seek position from the start of the stream. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#method.stream_position">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.seek_relative" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.80.0">1.80.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#2200">Source</a></span><a href="#method.seek_relative" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#method.seek_relative" class="fn">seek_relative</a>(&mut self, offset: <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <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>></h4></section></summary><div class='docblock'>Seeks relative to the current position. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Seek.html#method.seek_relative">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Write-for-SyncIoBridge%3CT%3E" class="impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#315-335">Source</a><a href="#impl-Write-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite">AsyncWrite</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>> <a class="trait" href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.write" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#316-319">Source</a><a href="#method.write" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#tymethod.write" class="fn">write</a>(&mut self, buf: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class='docblock'>Writes a buffer into this writer, returning how many bytes were written. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#tymethod.write">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.flush" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#321-324">Source</a><a href="#method.flush" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#tymethod.flush" class="fn">flush</a>(&mut self) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>></h4></section></summary><div class='docblock'>Flushes this output stream, ensuring that all intermediately buffered
|
||
contents reach their destination. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#tymethod.flush">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_all" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#326-329">Source</a><a href="#method.write_all" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.write_all" class="fn">write_all</a>(&mut self, buf: &[<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.u8.html">u8</a>]) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>></h4></section></summary><div class='docblock'>Attempts to write an entire buffer into this writer. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.write_all">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_vectored" class="method trait-impl"><a class="src rightside" href="../../src/tokio_util/io/sync_bridge.rs.html#331-334">Source</a><a href="#method.write_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.write_vectored" class="fn">write_vectored</a>(&mut self, bufs: &[<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_>]) -> <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><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class='docblock'>Like <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#tymethod.write" title="method std::io::Write::write"><code>write</code></a>, except that it writes from a slice of buffers. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.write_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.is_write_vectored-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1813">Source</a><a href="#method.is_write_vectored-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.is_write_vectored" class="fn">is_write_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.bool.html">bool</a></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>can_vector</code>)</span></div></span><div class='docblock'>Determines if this <code>Write</code>r has an efficient <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.write_vectored" title="method std::io::Write::write_vectored"><code>write_vectored</code></a>
|
||
implementation. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.is_write_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_all_vectored" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1937">Source</a><a href="#method.write_all_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.write_all_vectored" class="fn">write_all_vectored</a>(&mut self, bufs: &mut [<a class="struct" href="https://doc.rust-lang.org/1.93.1/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_>]) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <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>></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>write_all_vectored</code>)</span></div></span><div class='docblock'>Attempts to write multiple buffers into this writer. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.write_all_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_fmt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#1990">Source</a></span><a href="#method.write_fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.write_fmt" class="fn">write_fmt</a>(&mut self, args: <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/fmt/struct.Arguments.html" title="struct core::fmt::Arguments">Arguments</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <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>></h4></section></summary><div class='docblock'>Writes a formatted string into this writer, returning any error
|
||
encountered. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.write_fmt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.by_ref-1" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.93.1/src/std/io/mod.rs.html#2020-2022">Source</a></span><a href="#method.by_ref-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.by_ref" class="fn">by_ref</a>(&mut self) -> &mut Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates a “by reference” adapter for this instance of <code>Write</code>. <a href="https://doc.rust-lang.org/1.93.1/std/io/trait.Write.html#method.by_ref">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-SyncIoBridge%3CT%3E" class="impl"><a href="#impl-Freeze-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a>,</div></h3></section><section id="impl-RefUnwindSafe-for-SyncIoBridge%3CT%3E" class="impl"><a href="#impl-RefUnwindSafe-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Send-for-SyncIoBridge%3CT%3E" class="impl"><a href="#impl-Send-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Sync-for-SyncIoBridge%3CT%3E" class="impl"><a href="#impl-Sync-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section><section id="impl-Unpin-for-SyncIoBridge%3CT%3E" class="impl"><a href="#impl-Unpin-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnwindSafe-for-SyncIoBridge%3CT%3E" class="impl"><a href="#impl-UnwindSafe-for-SyncIoBridge%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.SyncIoBridge.html" title="struct tokio_util::io::SyncIoBridge">SyncIoBridge</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</div></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.93.1/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#212">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#214">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#221">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/borrow.rs.html#222">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.93.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#785">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#788">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#767-769">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#777">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code><a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#827-829">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#831">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#834">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#811-813">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#815">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.93.1/src/core/convert/mod.rs.html#818">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html> |