mentat/tokio_core/reactor/struct.Core.html
2018-08-22 17:04:13 +00:00

186 lines
No EOL
16 KiB
HTML
Raw Permalink 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="API documentation for the Rust `Core` struct in crate `tokio_core`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Core">
<title>tokio_core::reactor::Core - 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="../../dark.css">
<link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
<script src="../../storage.js"></script>
</head>
<body class="rustdoc struct">
<!--[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>
<p class='location'>Struct Core</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a><a href="#method.handle">handle</a><a href="#method.runtime">runtime</a><a href="#method.remote">remote</a><a href="#method.run">run</a><a href="#method.turn">turn</a><a href="#method.id">id</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Executor%3CF%3E">Executor&lt;F&gt;</a><a href="#impl-Debug">Debug</a></div></div><p class='location'><a href='../index.html'>tokio_core</a>::<wbr><a href='index.html'>reactor</a></p><script>window.sidebarCurrent = {name: 'Core', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
</nav>
<div class="theme-picker">
<button id="theme-picker" aria-label="Pick another theme!">
<img src="../../brush.svg" width="18" alt="Pick another theme!">
</button>
<div id="theme-choices"></div>
</div>
<script src="../../theme.js"></script>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>tokio_core</a>::<wbr><a href='index.html'>reactor</a>::<wbr><a class="struct" href=''>Core</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/tokio_core/reactor/mod.rs.html#46-73' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Core { /* fields omitted */ }</pre><div class='docblock'><p>An event loop.</p>
<p>The event loop is the main source of blocking in an application which drives
all other I/O events and notifications happening. Each event loop can have
multiple handles pointing to it, each of which can then be used to create
various I/O objects to interact with the event loop in interesting ways.</p>
</div>
<h2 id='methods' class='small-section-header'>
Methods<a href='#methods' class='anchor'></a>
</h2>
<h3 id='impl' class='impl'><span class='in-band'><code>impl <a class="struct" href="../../tokio_core/reactor/struct.Core.html" title="struct tokio_core::reactor::Core">Core</a></code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#117-336' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>() -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="../../tokio_core/reactor/struct.Core.html" title="struct tokio_core::reactor::Core">Core</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#120-157' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Creates a new event loop, returning any error that happened during the
creation.</p>
</div><h4 id='method.handle' class="method"><span id='handle.v' class='invisible'><code>pub fn <a href='#method.handle' class='fnname'>handle</a>(&amp;self) -&gt; <a class="struct" href="../../tokio_core/reactor/struct.Handle.html" title="struct tokio_core::reactor::Handle">Handle</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#165-171' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns a handle to this event loop which cannot be sent across threads
but can be used as a proxy to the event loop itself.</p>
<p>Handles are cloneable and clones always refer to the same event loop.
This handle is typically passed into functions that create I/O objects
to bind them to this event loop.</p>
</div><h4 id='method.runtime' class="method"><span id='runtime.v' class='invisible'><code>pub fn <a href='#method.runtime' class='fnname'>runtime</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../tokio/runtime/struct.Runtime.html" title="struct tokio::runtime::Runtime">Runtime</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#176-178' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns a reference to the runtime backing the instance</p>
<p>This provides access to the newer features of Tokio.</p>
</div><h4 id='method.remote' class="method"><span id='remote.v' class='invisible'><code>pub fn <a href='#method.remote' class='fnname'>remote</a>(&amp;self) -&gt; <a class="struct" href="../../tokio_core/reactor/struct.Remote.html" title="struct tokio_core::reactor::Remote">Remote</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#182-189' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Generates a remote handle to this event loop which can be used to spawn
tasks from other threads into this event loop.</p>
</div><h4 id='method.run' class="method"><span id='run.v' class='invisible'><code>pub fn <a href='#method.run' class='fnname'>run</a>&lt;F&gt;(&amp;mut self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;F::<a class="type" href="../../futures/future/trait.Future.html#associatedtype.Item" title="type futures::future::Future::Item">Item</a>, F::<a class="type" href="../../futures/future/trait.Future.html#associatedtype.Error" title="type futures::future::Future::Error">Error</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a>,&nbsp;</span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#209-250' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Runs a future until completion, driving the event loop while we're
otherwise waiting for the future to complete.</p>
<p>This function will begin executing the event loop and will finish once
the provided future is resolved. Note that the future argument here
crucially does not require the <code>'static</code> nor <code>Send</code> bounds. As a result
the future will be &quot;pinned&quot; to not only this thread but also this stack
frame.</p>
<p>This function will return the value that the future resolves to once
the future has finished. If the future never resolves then this function
will never return.</p>
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
<p>This method will <strong>not</strong> catch panics from polling the future <code>f</code>. If
the future panics then it's the responsibility of the caller to catch
that panic and handle it as appropriate.</p>
</div><h4 id='method.turn' class="method"><span id='turn.v' class='invisible'><code>pub fn <a href='#method.turn' class='fnname'>turn</a>(&amp;mut self, max_wait: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>&gt;)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#260-264' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs one iteration of the event loop, blocking on waiting for events
for at most <code>max_wait</code> (forever if <code>None</code>).</p>
<p>It only makes sense to call this method if you've previously spawned
a future onto this event loop.</p>
<p><code>loop { lp.turn(None) }</code> is equivalent to calling <code>run</code> with an
empty future (one that never finishes).</p>
</div><h4 id='method.id' class="method"><span id='id.v' class='invisible'><code>pub fn <a href='#method.id' class='fnname'>id</a>(&amp;self) -&gt; <a class="struct" href="../../tokio_core/reactor/struct.CoreId.html" title="struct tokio_core::reactor::CoreId">CoreId</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#333-335' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Get the ID of this loop</p>
</div></div>
<h2 id='implementations' class='small-section-header'>
Trait Implementations<a href='#implementations' class='anchor'></a>
</h2>
<h3 id='impl-Executor%3CF%3E' class='impl'><span class='in-band'><code>impl&lt;F&gt; <a class="trait" href="../../futures/future/trait.Executor.html" title="trait futures::future::Executor">Executor</a>&lt;F&gt; for <a class="struct" href="../../tokio_core/reactor/struct.Core.html" title="struct tokio_core::reactor::Core">Core</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Error = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt; + 'static,&nbsp;</span></code><a href='#impl-Executor%3CF%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#338-344' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.execute' class="method"><span id='execute.v' class='invisible'><code>fn <a href='../../futures/future/trait.Executor.html#tymethod.execute' class='fnname'>execute</a>(&amp;self, future: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="../../futures/future/struct.ExecuteError.html" title="struct futures::future::ExecuteError">ExecuteError</a>&lt;F&gt;&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#341-343' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Spawns a future to run on this <code>Executor</code>, typically in the &quot;background&quot;. <a href="../../futures/future/trait.Executor.html#tymethod.execute">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../tokio_core/reactor/struct.Core.html" title="struct tokio_core::reactor::Core">Core</a></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#346-352' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_core/reactor/mod.rs.html#347-351' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt><kbd>?</kbd></dt>
<dd>Show this help dialog</dd>
<dt><kbd>S</kbd></dt>
<dd>Focus the search field</dd>
<dt><kbd></kbd></dt>
<dd>Move up in search results</dd>
<dt><kbd></kbd></dt>
<dd>Move down in search results</dd>
<dt><kbd></kbd></dt>
<dd>Switch tab</dd>
<dt><kbd>&#9166;</kbd></dt>
<dd>Go to active search result</dd>
<dt><kbd>+</kbd></dt>
<dd>Expand all sections</dd>
<dt><kbd>-</kbd></dt>
<dd>Collapse all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "tokio_core";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>