34 lines
7.4 KiB
HTML
34 lines
7.4 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="API documentation for the Rust `tokio_current_thread` crate."><meta name="keywords" content="rust, rustlang, rust-lang, tokio_current_thread"><title>tokio_current_thread - 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="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><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">☰</div><a href='../tokio_current_thread/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate tokio_current_thread</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all tokio_current_thread's items</p></a><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'tokio_current_thread', ty: 'mod', relpath: '../'};</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"><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><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'>−</span>]</a></span><a class='srclink' href='../src/tokio_current_thread/lib.rs.html#1-882' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>tokio_current_thread</a></span></h1><div class='docblock'><p>A single-threaded executor which executes tasks on the same thread from which
|
||
they are spawned.</p>
|
||
<blockquote>
|
||
<p><strong>Note:</strong> This crate is <strong>deprecated in tokio 0.2.x</strong> and has been moved
|
||
and refactored into various places in the <a href="https://docs.rs/tokio/latest/tokio/index.html"><code>tokio</code></a> crate. The closest
|
||
replacement is to make use of <a href="https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html#method.block_on"><code>tokio::task::LocalSet::block_on</code></a> which
|
||
requires the <a href="https://docs.rs/tokio/latest/tokio/index.html#feature-flags"><code>rt-util</code> feature</a>.</p>
|
||
</blockquote>
|
||
<p>The crate provides:</p>
|
||
<ul>
|
||
<li><a href="struct.CurrentThread.html"><code>CurrentThread</code></a> is the main type of this crate. It executes tasks on the current thread.
|
||
The easiest way to start a new <a href="struct.CurrentThread.html"><code>CurrentThread</code></a> executor is to call
|
||
<a href="fn.block_on_all.html"><code>block_on_all</code></a> with an initial task to seed the executor.
|
||
All tasks that are being managed by a <a href="struct.CurrentThread.html"><code>CurrentThread</code></a> executor are able to
|
||
spawn additional tasks by calling <a href="fn.spawn.html"><code>spawn</code></a>.</li>
|
||
</ul>
|
||
<p>Application authors will not use this crate directly. Instead, they will use the
|
||
<code>tokio</code> crate. Library authors should only depend on <code>tokio-current-thread</code> if they
|
||
are building a custom task executor.</p>
|
||
<p>For more details, see <a href="https://docs.rs/tokio/0.1/tokio/executor/index.html">executor module</a> documentation in the Tokio crate.</p>
|
||
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
||
<table><tr class='module-item'><td><a class="struct" href="struct.BlockError.html" title='tokio_current_thread::BlockError struct'>BlockError</a></td><td class='docblock-short'><p>Error returned by the <code>block_on</code> function.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.CurrentThread.html" title='tokio_current_thread::CurrentThread struct'>CurrentThread</a></td><td class='docblock-short'><p>Executes tasks on the current thread</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Entered.html" title='tokio_current_thread::Entered struct'>Entered</a></td><td class='docblock-short'><p>A <code>CurrentThread</code> instance bound to a supplied execution context.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Handle.html" title='tokio_current_thread::Handle struct'>Handle</a></td><td class='docblock-short'><p>Handle to spawn a future on the corresponding <code>CurrentThread</code> instance</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.RunError.html" title='tokio_current_thread::RunError struct'>RunError</a></td><td class='docblock-short'><p>Error returned by the <code>run</code> function.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.RunTimeoutError.html" title='tokio_current_thread::RunTimeoutError struct'>RunTimeoutError</a></td><td class='docblock-short'><p>Error returned by the <code>run_timeout</code> function.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.TaskExecutor.html" title='tokio_current_thread::TaskExecutor struct'>TaskExecutor</a></td><td class='docblock-short'><p>Executes futures on the current thread.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Turn.html" title='tokio_current_thread::Turn struct'>Turn</a></td><td class='docblock-short'><p>Returned by the <code>turn</code> function.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.TurnError.html" title='tokio_current_thread::TurnError struct'>TurnError</a></td><td class='docblock-short'><p>Error returned by the <code>turn</code> function.</p>
|
||
</td></tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
||
<table><tr class='module-item'><td><a class="fn" href="fn.block_on_all.html" title='tokio_current_thread::block_on_all fn'>block_on_all</a></td><td class='docblock-short'><p>Run the executor bootstrapping the execution with the provided future.</p>
|
||
</td></tr><tr class='module-item'><td><a class="fn" href="fn.spawn.html" title='tokio_current_thread::spawn fn'>spawn</a></td><td class='docblock-short'><p>Executes a future on the current thread.</p>
|
||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "tokio_current_thread";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |