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

41 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="`tokio` runtime components integration for `hyper`."><title>hyper_util::rt::tokio - 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="hyper_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 tokio</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../hyper_util/index.html">hyper_<wbr>util</a><span class="version">0.1.20</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module tokio</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#io" title="IO">IO</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In hyper_<wbr>util::<wbr>rt</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">hyper_util</a>::<wbr><a href="../index.html">rt</a></div><h1>Module <span>tokio</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/hyper_util/rt/tokio.rs.html#1-342">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><a href="../../../tokio/index.html" title="mod tokio"><code>tokio</code></a> runtime components integration for <a href="../../../hyper/index.html" title="mod hyper"><code>hyper</code></a>.</p>
<p><a href="../../../hyper/rt/index.html" title="mod hyper::rt"><code>hyper::rt</code></a> exposes a set of traits to allow hyper to be agnostic to
its underlying asynchronous runtime. This submodule provides glue for
<a href="../../../tokio/index.html" title="mod tokio"><code>tokio</code></a> users to bridge those types to <a href="../../../hyper/index.html" title="mod hyper"><code>hyper</code></a>s interfaces.</p>
<h2 id="io"><a class="doc-anchor" href="#io">§</a>IO</h2>
<p><a href="../../../hyper/index.html" title="mod hyper"><code>hyper</code></a> abstracts over asynchronous readers and writers using <a href="../../../hyper/rt/io/trait.Read.html" title="trait hyper::rt::io::Read"><code>Read</code></a>
and <a href="../../../hyper/rt/io/trait.Write.html" title="trait hyper::rt::io::Write"><code>Write</code></a>, while <a href="../../../tokio/index.html" title="mod tokio"><code>tokio</code></a> abstracts over this using <a href="../../../tokio/io/async_read/trait.AsyncRead.html" title="trait tokio::io::async_read::AsyncRead"><code>AsyncRead</code></a>
and <a href="../../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite"><code>AsyncWrite</code></a>. This submodule provides a collection of IO adaptors
to bridge these two IO ecosystems together: <a href="struct.TokioIo.html" title="struct hyper_util::rt::tokio::TokioIo"><code>TokioIo&lt;I&gt;</code></a>,
<a href="struct.WithHyperIo.html" title="struct hyper_util::rt::tokio::WithHyperIo"><code>WithHyperIo&lt;I&gt;</code></a>, and <a href="struct.WithTokioIo.html" title="struct hyper_util::rt::tokio::WithTokioIo"><code>WithTokioIo&lt;I&gt;</code></a>.</p>
<p>To compare and constrast these IO adaptors and to help explain which
is the proper choice for your needs, here is a table showing which IO
traits these implement, given two types <code>T</code> and <code>H</code> which implement
Tokios and Hypers corresponding IO traits:</p>
<div><table><thead><tr><th></th><th><a href="../../../tokio/io/async_read/trait.AsyncRead.html" title="trait tokio::io::async_read::AsyncRead"><code>AsyncRead</code></a></th><th><a href="../../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite"><code>AsyncWrite</code></a></th><th><a href="../../../hyper/rt/io/trait.Read.html" title="trait hyper::rt::io::Read"><code>Read</code></a></th><th><a href="../../../hyper/rt/io/trait.Write.html" title="trait hyper::rt::io::Write"><code>Write</code></a></th></tr></thead><tbody>
<tr><td><code>T</code></td><td><strong>true</strong></td><td><strong>true</strong></td><td><strong>false</strong></td><td><strong>false</strong></td></tr>
<tr><td><code>H</code></td><td><strong>false</strong></td><td><strong>false</strong></td><td><strong>true</strong></td><td><strong>true</strong></td></tr>
<tr><td><a href="struct.TokioIo.html" title="struct hyper_util::rt::tokio::TokioIo"><code>TokioIo&lt;T&gt;</code></a></td><td><strong>false</strong></td><td><strong>false</strong></td><td><strong>true</strong></td><td><strong>true</strong></td></tr>
<tr><td><a href="struct.TokioIo.html" title="struct hyper_util::rt::tokio::TokioIo"><code>TokioIo&lt;H&gt;</code></a></td><td><strong>true</strong></td><td><strong>true</strong></td><td><strong>false</strong></td><td><strong>false</strong></td></tr>
<tr><td><a href="struct.WithHyperIo.html" title="struct hyper_util::rt::tokio::WithHyperIo"><code>WithHyperIo&lt;T&gt;</code></a></td><td><strong>true</strong></td><td><strong>true</strong></td><td><strong>true</strong></td><td><strong>true</strong></td></tr>
<tr><td><a href="struct.WithHyperIo.html" title="struct hyper_util::rt::tokio::WithHyperIo"><code>WithHyperIo&lt;H&gt;</code></a></td><td><strong>false</strong></td><td><strong>false</strong></td><td><strong>false</strong></td><td><strong>false</strong></td></tr>
<tr><td><a href="struct.WithTokioIo.html" title="struct hyper_util::rt::tokio::WithTokioIo"><code>WithTokioIo&lt;T&gt;</code></a></td><td><strong>false</strong></td><td><strong>false</strong></td><td><strong>false</strong></td><td><strong>false</strong></td></tr>
<tr><td><a href="struct.WithTokioIo.html" title="struct hyper_util::rt::tokio::WithTokioIo"><code>WithTokioIo&lt;H&gt;</code></a></td><td><strong>true</strong></td><td><strong>true</strong></td><td><strong>true</strong></td><td><strong>true</strong></td></tr>
</tbody></table>
</div>
<p>For most situations, <a href="struct.TokioIo.html" title="struct hyper_util::rt::tokio::TokioIo"><code>TokioIo&lt;I&gt;</code></a> is the proper choice. This should be
constructed, wrapping some underlying <a href="../../../hyper/index.html" title="mod hyper"><code>hyper</code></a> or <a href="../../../tokio/index.html" title="mod tokio"><code>tokio</code></a> IO, at the
call-site of a function like <a href="../../../hyper/client/conn/http1/fn.handshake.html" title="fn hyper::client::conn::http1::handshake"><code>hyper::client::conn::http1::handshake</code></a>.</p>
<p><a href="struct.TokioIo.html" title="struct hyper_util::rt::tokio::TokioIo"><code>TokioIo&lt;I&gt;</code></a> switches across these ecosystems, but notably does not
preserve the existing IO trait implementations of its underlying IO. If
one wishes to <em>extend</em> IO with additional implementations,
<a href="struct.WithHyperIo.html" title="struct hyper_util::rt::tokio::WithHyperIo"><code>WithHyperIo&lt;I&gt;</code></a> and <a href="struct.WithTokioIo.html" title="struct hyper_util::rt::tokio::WithTokioIo"><code>WithTokioIo&lt;I&gt;</code></a> are the correct choice.</p>
<p>For example, a Tokio reader/writer can be wrapped in <a href="struct.WithHyperIo.html" title="struct hyper_util::rt::tokio::WithHyperIo"><code>WithHyperIo&lt;I&gt;</code></a>.
That will implement <em>both</em> sets of IO traits. Conversely,
<a href="struct.WithTokioIo.html" title="struct hyper_util::rt::tokio::WithTokioIo"><code>WithTokioIo&lt;I&gt;</code></a> will implement both sets of IO traits given a
reader/writer that implements Hypers <a href="../../../hyper/rt/io/trait.Read.html" title="trait hyper::rt::io::Read"><code>Read</code></a> and <a href="../../../hyper/rt/io/trait.Write.html" title="trait hyper::rt::io::Write"><code>Write</code></a>.</p>
<p>See <a href="../../../tokio/io/index.html" title="mod tokio::io"><code>tokio::io</code></a> and <a href="https://docs.rs/tokio/latest/tokio/#asynchronous-io"><em>Asynchronous IO</em></a> for more
information.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.TokioExecutor.html" title="struct hyper_util::rt::tokio::TokioExecutor">Tokio<wbr>Executor</a></dt><dd>Future executor that utilises <code>tokio</code> threads.</dd><dt><a class="struct" href="struct.TokioIo.html" title="struct hyper_util::rt::tokio::TokioIo">TokioIo</a></dt><dd>A wrapper that implements Tokios IO traits for an inner type that
implements hypers IO traits, or vice versa (implements hypers IO
traits for a type that implements Tokios IO traits).</dd><dt><a class="struct" href="struct.TokioTimer.html" title="struct hyper_util::rt::tokio::TokioTimer">Tokio<wbr>Timer</a></dt><dd>A Timer that uses the tokio runtime.</dd><dt><a class="struct" href="struct.WithHyperIo.html" title="struct hyper_util::rt::tokio::WithHyperIo">With<wbr>Hyper<wbr>Io</a></dt><dd>Extends an underlying <a href="../../../tokio/index.html" title="mod tokio"><code>tokio</code></a> I/O with <a href="../../../hyper/index.html" title="mod hyper"><code>hyper</code></a> I/O implementations.</dd><dt><a class="struct" href="struct.WithTokioIo.html" title="struct hyper_util::rt::tokio::WithTokioIo">With<wbr>Tokio<wbr>Io</a></dt><dd>Extends an underlying <a href="../../../hyper/index.html" title="mod hyper"><code>hyper</code></a> I/O with <a href="../../../tokio/index.html" title="mod tokio"><code>tokio</code></a> I/O implementations.</dd></dl></section></div></main></body></html>