Auto Generated Documentation

This commit is contained in:
github-actions[bot]
2021-03-14 20:06:11 +00:00
parent fcf47cbac9
commit 799a22692f
11450 changed files with 65837 additions and 83717 deletions
+12 -13
View File
@@ -1,14 +1,14 @@
<!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="Getting started guide."><meta name="keywords" content="rust, rustlang, rust-lang, guide"><title>mio::guide - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `guide` mod in crate `mio`."><meta name="keywords" content="rust, rustlang, rust-lang, guide"><title>mio::guide - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../mio/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module guide</p><div class="sidebar-elems"><p class="location"><a href="../index.html">mio</a></p><div id="sidebar-vars" data-name="guide" data-ty="mod" data-relpath="../"></div><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">mio</a>::<wbr><a class="mod" href="">guide</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/mio/lib.rs.html#121-265" title="goto source code">[src]</a></span></h1><div class="docblock"><h1 id="getting-started-guide" class="section-header"><a href="#getting-started-guide">Getting started guide.</a></h1>
<p>In this guide well do the following:</p>
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../mio/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module guide</p><div class="sidebar-elems"><p class="location"><a href="../index.html">mio</a></p><script>window.sidebarCurrent = {name: "guide", ty: "mod", relpath: "../"};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/mio/lib.rs.html#121-265" title="goto source code">[src]</a></span><span class="in-band">Module <a href="../index.html">mio</a>::<wbr><a class="mod" href="">guide</a></span></h1><div class="docblock"><h1 id="getting-started-guide" class="section-header"><a href="#getting-started-guide">Getting started guide.</a></h1>
<p>In this guide we'll do the following:</p>
<ol>
<li>Create a <a href="../struct.Poll.html"><code>Poll</code></a> instance (and learn what it is).</li>
<li>Register an <a href="../event/trait.Source.html">event source</a>.</li>
<li>Create an event loop.</li>
</ol>
<p>At the end youll have a very small (but quick) TCP server that accepts
<p>At the end you'll have a very small (but quick) TCP server that accepts
connections and then drops (disconnects) them.</p>
<h2 id="1-creating-a-poll-instance" class="section-header"><a href="#1-creating-a-poll-instance">1. Creating a <code>Poll</code> instance</a></h2>
<p>Using Mio starts by creating a <a href="../struct.Poll.html"><code>Poll</code></a> instance, which monitors events
@@ -21,18 +21,18 @@ operations based on what operations are ready.</p>
<span class="comment">// `Events` is collection of readiness `Event`s and can be filled by</span>
<span class="comment">// calling `Poll::poll`.</span>
<span class="kw">let</span> <span class="ident">events</span> <span class="op">=</span> <span class="ident">Events</span>::<span class="ident">with_capacity</span>(<span class="number">128</span>);</pre></div>
<p>For example if were using a <a href="../net/struct.TcpListener.html"><code>TcpListener</code></a>, well only want to
<p>For example if we're using a <a href="../net/struct.TcpListener.html"><code>TcpListener</code></a>, we'll only want to
attempt to accept an incoming connection <em>iff</em> any connections are
queued and ready to be accepted. We dont want to waste our time if no
queued and ready to be accepted. We don't want to waste our time if no
connections are ready.</p>
<h2 id="2-registering-event-source" class="section-header"><a href="#2-registering-event-source">2. Registering event source</a></h2>
<p>After weve created a <a href="../struct.Poll.html"><code>Poll</code></a> instance that monitors events from the OS
<p>After we've created a <a href="../struct.Poll.html"><code>Poll</code></a> instance that monitors events from the OS
for us, we need to provide it with a source of events. This is done by
registering an <a href="../event/trait.Source.html">event source</a>. As the name “event source” suggests it is
a source of events which can be polled using a <code>Poll</code> instance. On Unix
systems this is usually a file descriptor, or a socket/handle on
Windows.</p>
<p>In the example below well use a <a href="../net/struct.TcpListener.html"><code>TcpListener</code></a> for which well receive
<p>In the example below we'll use a <a href="../net/struct.TcpListener.html"><code>TcpListener</code></a> for which we'll receive
an event (from <a href="../struct.Poll.html"><code>Poll</code></a>) once a connection is ready to be accepted.</p>
<div class='information'><div class='tooltip ignore'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
@@ -47,11 +47,11 @@ an event (from <a href="../struct.Poll.html"><code>Poll</code></a>) once a conne
<p>Multiple event sources can be <a href="../struct.Registry.html#method.register">registered</a> (concurrently), so we can
monitor multiple sources at a time.</p>
<h2 id="3-creating-the-event-loop" class="section-header"><a href="#3-creating-the-event-loop">3. Creating the event loop</a></h2>
<p>After weve created a <a href="../struct.Poll.html"><code>Poll</code></a> instance and registered one or more
<p>After we've created a <a href="../struct.Poll.html"><code>Poll</code></a> instance and registered one or more
<a href="../event/trait.Source.html">event sources</a> with it, we can <a href="../struct.Poll.html#method.poll">poll</a> it for events. Polling for events
is simple, we need a container to store the events: <a href="../event/struct.Events.html"><code>Events</code></a> and need
to do something based on the polled events (this part is up to you, we
cant do it all!). If we do this in a loop weve got ourselves an event
can't do it all!). If we do this in a loop we've got ourselves an event
loop.</p>
<p>The example below shows the event loop in action, completing our small
TCP server.</p>
@@ -88,5 +88,4 @@ TCP server.</p>
<span class="kw">fn</span> <span class="ident">would_block</span>(<span class="ident">err</span>: <span class="kw-2">&amp;</span><span class="ident">io</span>::<span class="ident">Error</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">bool</span> {
<span class="ident">err</span>.<span class="ident">kind</span>() <span class="op">=</span><span class="op">=</span> <span class="ident">io</span>::<span class="ident">ErrorKind</span>::<span class="ident">WouldBlock</span>
}</pre></div>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="mio"></div>
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "mio";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>