| <!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="Multi-producer multi-consumer channels for message passing."><meta name="keywords" content="rust, rustlang, rust-lang, crossbeam_channel"><title>crossbeam_channel - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="../crates.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../crossbeam_channel/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../crossbeam_channel/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Crate crossbeam_channel</a></h2><div class="sidebar-elems"><ul class="block"><li class="version">Version 0.5.8</li><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Crate <a class="mod" href="#">crossbeam_channel</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/crossbeam_channel/lib.rs.html#1-371">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Multi-producer multi-consumer channels for message passing.</p> |
| <p>This crate is an alternative to [<code>std::sync::mpsc</code>] with more features and better performance.</p> |
| <h2 id="hello-world"><a href="#hello-world">Hello, world!</a></h2> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_channel::unbounded; |
| |
| <span class="comment">// Create a channel of unbounded capacity. |
| </span><span class="kw">let </span>(s, r) = unbounded(); |
| |
| <span class="comment">// Send a message into the channel. |
| </span>s.send(<span class="string">"Hello, world!"</span>).unwrap(); |
| |
| <span class="comment">// Receive the message from the channel. |
| </span><span class="macro">assert_eq!</span>(r.recv(), <span class="prelude-val">Ok</span>(<span class="string">"Hello, world!"</span>));</code></pre></div> |
| <h2 id="channel-types"><a href="#channel-types">Channel types</a></h2> |
| <p>Channels can be created using two functions:</p> |
| <ul> |
| <li> |
| <p><a href="fn.bounded.html" title="bounded"><code>bounded</code></a> creates a channel of bounded capacity, i.e. there is a limit to how many messages |
| it can hold at a time.</p> |
| </li> |
| <li> |
| <p><a href="fn.unbounded.html" title="unbounded"><code>unbounded</code></a> creates a channel of unbounded capacity, i.e. it can hold any number of |
| messages at a time.</p> |
| </li> |
| </ul> |
| <p>Both functions return a <a href="struct.Sender.html" title="Sender"><code>Sender</code></a> and a <a href="struct.Receiver.html" title="Receiver"><code>Receiver</code></a>, which represent the two opposite sides |
| of a channel.</p> |
| <p>Creating a bounded channel:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_channel::bounded; |
| |
| <span class="comment">// Create a channel that can hold at most 5 messages at a time. |
| </span><span class="kw">let </span>(s, r) = bounded(<span class="number">5</span>); |
| |
| <span class="comment">// Can send only 5 messages without blocking. |
| </span><span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">5 </span>{ |
| s.send(i).unwrap(); |
| } |
| |
| <span class="comment">// Another call to `send` would block because the channel is full. |
| // s.send(5).unwrap();</span></code></pre></div> |
| <p>Creating an unbounded channel:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_channel::unbounded; |
| |
| <span class="comment">// Create an unbounded channel. |
| </span><span class="kw">let </span>(s, r) = unbounded(); |
| |
| <span class="comment">// Can send any number of messages into the channel without blocking. |
| </span><span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">1000 </span>{ |
| s.send(i).unwrap(); |
| }</code></pre></div> |
| <p>A special case is zero-capacity channel, which cannot hold any messages. Instead, send and |
| receive operations must appear at the same time in order to pair up and pass the message over:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::thread; |
| <span class="kw">use </span>crossbeam_channel::bounded; |
| |
| <span class="comment">// Create a zero-capacity channel. |
| </span><span class="kw">let </span>(s, r) = bounded(<span class="number">0</span>); |
| |
| <span class="comment">// Sending blocks until a receive operation appears on the other side. |
| </span>thread::spawn(<span class="kw">move </span>|| s.send(<span class="string">"Hi!"</span>).unwrap()); |
| |
| <span class="comment">// Receiving blocks until a send operation appears on the other side. |
| </span><span class="macro">assert_eq!</span>(r.recv(), <span class="prelude-val">Ok</span>(<span class="string">"Hi!"</span>));</code></pre></div> |
| <h2 id="sharing-channels"><a href="#sharing-channels">Sharing channels</a></h2> |
| <p>Senders and receivers can be cloned and sent to other threads:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::thread; |
| <span class="kw">use </span>crossbeam_channel::bounded; |
| |
| <span class="kw">let </span>(s1, r1) = bounded(<span class="number">0</span>); |
| <span class="kw">let </span>(s2, r2) = (s1.clone(), r1.clone()); |
| |
| <span class="comment">// Spawn a thread that receives a message and then sends one. |
| </span>thread::spawn(<span class="kw">move </span>|| { |
| r2.recv().unwrap(); |
| s2.send(<span class="number">2</span>).unwrap(); |
| }); |
| |
| <span class="comment">// Send a message and then receive one. |
| </span>s1.send(<span class="number">1</span>).unwrap(); |
| r1.recv().unwrap();</code></pre></div> |
| <p>Note that cloning only creates a new handle to the same sending or receiving side. It does not |
| create a separate stream of messages in any way:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_channel::unbounded; |
| |
| <span class="kw">let </span>(s1, r1) = unbounded(); |
| <span class="kw">let </span>(s2, r2) = (s1.clone(), r1.clone()); |
| <span class="kw">let </span>(s3, r3) = (s2.clone(), r2.clone()); |
| |
| s1.send(<span class="number">10</span>).unwrap(); |
| s2.send(<span class="number">20</span>).unwrap(); |
| s3.send(<span class="number">30</span>).unwrap(); |
| |
| <span class="macro">assert_eq!</span>(r3.recv(), <span class="prelude-val">Ok</span>(<span class="number">10</span>)); |
| <span class="macro">assert_eq!</span>(r1.recv(), <span class="prelude-val">Ok</span>(<span class="number">20</span>)); |
| <span class="macro">assert_eq!</span>(r2.recv(), <span class="prelude-val">Ok</span>(<span class="number">30</span>));</code></pre></div> |
| <p>It’s also possible to share senders and receivers by reference:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_channel::bounded; |
| <span class="kw">use </span>crossbeam_utils::thread::scope; |
| |
| <span class="kw">let </span>(s, r) = bounded(<span class="number">0</span>); |
| |
| scope(|scope| { |
| <span class="comment">// Spawn a thread that receives a message and then sends one. |
| </span>scope.spawn(|<span class="kw">_</span>| { |
| r.recv().unwrap(); |
| s.send(<span class="number">2</span>).unwrap(); |
| }); |
| |
| <span class="comment">// Send a message and then receive one. |
| </span>s.send(<span class="number">1</span>).unwrap(); |
| r.recv().unwrap(); |
| }).unwrap();</code></pre></div> |
| <h2 id="disconnection"><a href="#disconnection">Disconnection</a></h2> |
| <p>When all senders or all receivers associated with a channel get dropped, the channel becomes |
| disconnected. No more messages can be sent, but any remaining messages can still be received. |
| Send and receive operations on a disconnected channel never block.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_channel::{unbounded, RecvError}; |
| |
| <span class="kw">let </span>(s, r) = unbounded(); |
| s.send(<span class="number">1</span>).unwrap(); |
| s.send(<span class="number">2</span>).unwrap(); |
| s.send(<span class="number">3</span>).unwrap(); |
| |
| <span class="comment">// The only sender is dropped, disconnecting the channel. |
| </span>drop(s); |
| |
| <span class="comment">// The remaining messages can be received. |
| </span><span class="macro">assert_eq!</span>(r.recv(), <span class="prelude-val">Ok</span>(<span class="number">1</span>)); |
| <span class="macro">assert_eq!</span>(r.recv(), <span class="prelude-val">Ok</span>(<span class="number">2</span>)); |
| <span class="macro">assert_eq!</span>(r.recv(), <span class="prelude-val">Ok</span>(<span class="number">3</span>)); |
| |
| <span class="comment">// There are no more messages in the channel. |
| </span><span class="macro">assert!</span>(r.is_empty()); |
| |
| <span class="comment">// Note that calling `r.recv()` does not block. |
| // Instead, `Err(RecvError)` is returned immediately. |
| </span><span class="macro">assert_eq!</span>(r.recv(), <span class="prelude-val">Err</span>(RecvError));</code></pre></div> |
| <h2 id="blocking-operations"><a href="#blocking-operations">Blocking operations</a></h2> |
| <p>Send and receive operations come in three flavors:</p> |
| <ul> |
| <li>Non-blocking (returns immediately with success or failure).</li> |
| <li>Blocking (waits until the operation succeeds or the channel becomes disconnected).</li> |
| <li>Blocking with a timeout (blocks only for a certain duration of time).</li> |
| </ul> |
| <p>A simple example showing the difference between non-blocking and blocking operations:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_channel::{bounded, RecvError, TryRecvError}; |
| |
| <span class="kw">let </span>(s, r) = bounded(<span class="number">1</span>); |
| |
| <span class="comment">// Send a message into the channel. |
| </span>s.send(<span class="string">"foo"</span>).unwrap(); |
| |
| <span class="comment">// This call would block because the channel is full. |
| // s.send("bar").unwrap(); |
| |
| // Receive the message. |
| </span><span class="macro">assert_eq!</span>(r.recv(), <span class="prelude-val">Ok</span>(<span class="string">"foo"</span>)); |
| |
| <span class="comment">// This call would block because the channel is empty. |
| // r.recv(); |
| |
| // Try receiving a message without blocking. |
| </span><span class="macro">assert_eq!</span>(r.try_recv(), <span class="prelude-val">Err</span>(TryRecvError::Empty)); |
| |
| <span class="comment">// Disconnect the channel. |
| </span>drop(s); |
| |
| <span class="comment">// This call doesn't block because the channel is now disconnected. |
| </span><span class="macro">assert_eq!</span>(r.recv(), <span class="prelude-val">Err</span>(RecvError));</code></pre></div> |
| <h2 id="iteration"><a href="#iteration">Iteration</a></h2> |
| <p>Receivers can be used as iterators. For example, method <a href="struct.Receiver.html#method.iter"><code>iter</code></a> creates an iterator that |
| receives messages until the channel becomes empty and disconnected. Note that iteration may |
| block waiting for next message to arrive.</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::thread; |
| <span class="kw">use </span>crossbeam_channel::unbounded; |
| |
| <span class="kw">let </span>(s, r) = unbounded(); |
| |
| thread::spawn(<span class="kw">move </span>|| { |
| s.send(<span class="number">1</span>).unwrap(); |
| s.send(<span class="number">2</span>).unwrap(); |
| s.send(<span class="number">3</span>).unwrap(); |
| drop(s); <span class="comment">// Disconnect the channel. |
| </span>}); |
| |
| <span class="comment">// Collect all messages from the channel. |
| // Note that the call to `collect` blocks until the sender is dropped. |
| </span><span class="kw">let </span>v: Vec<<span class="kw">_</span>> = r.iter().collect(); |
| |
| <span class="macro">assert_eq!</span>(v, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);</code></pre></div> |
| <p>A non-blocking iterator can be created using <a href="struct.Receiver.html#method.try_iter"><code>try_iter</code></a>, which receives all available |
| messages without blocking:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>crossbeam_channel::unbounded; |
| |
| <span class="kw">let </span>(s, r) = unbounded(); |
| s.send(<span class="number">1</span>).unwrap(); |
| s.send(<span class="number">2</span>).unwrap(); |
| s.send(<span class="number">3</span>).unwrap(); |
| <span class="comment">// No need to drop the sender. |
| |
| // Receive all messages currently in the channel. |
| </span><span class="kw">let </span>v: Vec<<span class="kw">_</span>> = r.try_iter().collect(); |
| |
| <span class="macro">assert_eq!</span>(v, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);</code></pre></div> |
| <h2 id="selection"><a href="#selection">Selection</a></h2> |
| <p>The <a href="macro.select.html" title="select!"><code>select!</code></a> macro allows you to define a set of channel operations, wait until any one of |
| them becomes ready, and finally execute it. If multiple operations are ready at the same time, |
| a random one among them is selected.</p> |
| <p>It is also possible to define a <code>default</code> case that gets executed if none of the operations are |
| ready, either right away or for a certain duration of time.</p> |
| <p>An operation is considered to be ready if it doesn’t have to block. Note that it is ready even |
| when it will simply return an error because the channel is disconnected.</p> |
| <p>An example of receiving a message from two channels:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::thread; |
| <span class="kw">use </span>std::time::Duration; |
| <span class="kw">use </span>crossbeam_channel::{select, unbounded}; |
| |
| <span class="kw">let </span>(s1, r1) = unbounded(); |
| <span class="kw">let </span>(s2, r2) = unbounded(); |
| |
| thread::spawn(<span class="kw">move </span>|| s1.send(<span class="number">10</span>).unwrap()); |
| thread::spawn(<span class="kw">move </span>|| s2.send(<span class="number">20</span>).unwrap()); |
| |
| <span class="comment">// At most one of these two receive operations will be executed. |
| </span><span class="macro">select! </span>{ |
| recv(r1) -> msg => <span class="macro">assert_eq!</span>(msg, <span class="prelude-val">Ok</span>(<span class="number">10</span>)), |
| recv(r2) -> msg => <span class="macro">assert_eq!</span>(msg, <span class="prelude-val">Ok</span>(<span class="number">20</span>)), |
| default(Duration::from_secs(<span class="number">1</span>)) => <span class="macro">println!</span>(<span class="string">"timed out"</span>), |
| }</code></pre></div> |
| <p>If you need to select over a dynamically created list of channel operations, use <a href="struct.Select.html" title="Select"><code>Select</code></a> |
| instead. The <a href="macro.select.html" title="select!"><code>select!</code></a> macro is just a convenience wrapper around <a href="struct.Select.html" title="Select"><code>Select</code></a>.</p> |
| <h2 id="extra-channels"><a href="#extra-channels">Extra channels</a></h2> |
| <p>Three functions can create special kinds of channels, all of which return just a <a href="struct.Receiver.html" title="Receiver"><code>Receiver</code></a> |
| handle:</p> |
| <ul> |
| <li><a href="fn.after.html" title="after"><code>after</code></a> creates a channel that delivers a single message after a certain duration of time.</li> |
| <li><a href="fn.tick.html" title="tick"><code>tick</code></a> creates a channel that delivers messages periodically.</li> |
| <li><a href="fn.never.html"><code>never</code></a> creates a channel that never delivers messages.</li> |
| </ul> |
| <p>These channels are very efficient because messages get lazily generated on receive operations.</p> |
| <p>An example that prints elapsed time every 50 milliseconds for the duration of 1 second:</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::time::{Duration, Instant}; |
| <span class="kw">use </span>crossbeam_channel::{after, select, tick}; |
| |
| <span class="kw">let </span>start = Instant::now(); |
| <span class="kw">let </span>ticker = tick(Duration::from_millis(<span class="number">50</span>)); |
| <span class="kw">let </span>timeout = after(Duration::from_secs(<span class="number">1</span>)); |
| |
| <span class="kw">loop </span>{ |
| <span class="macro">select! </span>{ |
| recv(ticker) -> <span class="kw">_ </span>=> <span class="macro">println!</span>(<span class="string">"elapsed: {:?}"</span>, start.elapsed()), |
| recv(timeout) -> <span class="kw">_ </span>=> <span class="kw">break</span>, |
| } |
| }</code></pre></div> |
| </div></details><h2 id="macros" class="small-section-header"><a href="#macros">Macros</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="macro" href="macro.select.html" title="crossbeam_channel::select macro">select</a></div><div class="item-right docblock-short">Selects from a set of channel operations.</div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.IntoIter.html" title="crossbeam_channel::IntoIter struct">IntoIter</a></div><div class="item-right docblock-short">A blocking iterator over messages in a channel.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Iter.html" title="crossbeam_channel::Iter struct">Iter</a></div><div class="item-right docblock-short">A blocking iterator over messages in a channel.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ReadyTimeoutError.html" title="crossbeam_channel::ReadyTimeoutError struct">ReadyTimeoutError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Select.html#method.ready_timeout"><code>ready_timeout</code></a> method.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Receiver.html" title="crossbeam_channel::Receiver struct">Receiver</a></div><div class="item-right docblock-short">The receiving side of a channel.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.RecvError.html" title="crossbeam_channel::RecvError struct">RecvError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Receiver.html#method.recv"><code>recv</code></a> method.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Select.html" title="crossbeam_channel::Select struct">Select</a></div><div class="item-right docblock-short">Selects from a set of channel operations.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SelectTimeoutError.html" title="crossbeam_channel::SelectTimeoutError struct">SelectTimeoutError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Select.html#method.select_timeout"><code>select_timeout</code></a> method.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SelectedOperation.html" title="crossbeam_channel::SelectedOperation struct">SelectedOperation</a></div><div class="item-right docblock-short">A selected operation that needs to be completed.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SendError.html" title="crossbeam_channel::SendError struct">SendError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Sender.html#method.send"><code>send</code></a> method.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Sender.html" title="crossbeam_channel::Sender struct">Sender</a></div><div class="item-right docblock-short">The sending side of a channel.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.TryIter.html" title="crossbeam_channel::TryIter struct">TryIter</a></div><div class="item-right docblock-short">A non-blocking iterator over messages in a channel.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.TryReadyError.html" title="crossbeam_channel::TryReadyError struct">TryReadyError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Select.html#method.try_ready"><code>try_ready</code></a> method.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.TrySelectError.html" title="crossbeam_channel::TrySelectError struct">TrySelectError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Select.html#method.try_select"><code>try_select</code></a> method.</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.RecvTimeoutError.html" title="crossbeam_channel::RecvTimeoutError enum">RecvTimeoutError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Receiver.html#method.recv_timeout"><code>recv_timeout</code></a> method.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.SendTimeoutError.html" title="crossbeam_channel::SendTimeoutError enum">SendTimeoutError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Sender.html#method.send_timeout"><code>send_timeout</code></a> method.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.TryRecvError.html" title="crossbeam_channel::TryRecvError enum">TryRecvError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Receiver.html#method.try_recv"><code>try_recv</code></a> method.</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.TrySendError.html" title="crossbeam_channel::TrySendError enum">TrySendError</a></div><div class="item-right docblock-short">An error returned from the <a href="struct.Sender.html#method.try_send"><code>try_send</code></a> method.</div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.after.html" title="crossbeam_channel::after fn">after</a></div><div class="item-right docblock-short">Creates a receiver that delivers a message after a certain duration of time.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.at.html" title="crossbeam_channel::at fn">at</a></div><div class="item-right docblock-short">Creates a receiver that delivers a message at a certain instant in time.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.bounded.html" title="crossbeam_channel::bounded fn">bounded</a></div><div class="item-right docblock-short">Creates a channel of bounded capacity.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.never.html" title="crossbeam_channel::never fn">never</a></div><div class="item-right docblock-short">Creates a receiver that never delivers messages.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.tick.html" title="crossbeam_channel::tick fn">tick</a></div><div class="item-right docblock-short">Creates a receiver that delivers messages periodically.</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.unbounded.html" title="crossbeam_channel::unbounded fn">unbounded</a></div><div class="item-right docblock-short">Creates a channel of unbounded capacity.</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="crossbeam_channel" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html> |