<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Channels on rustbites</title><link>https://www.rustbites.com/tags/channels/</link><description>Recent content in Channels on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 27 Jul 2026 22:34:10 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/channels/index.xml" rel="self" type="application/rss+xml"/><item><title>285. try_iter — The Drain Loop You Wrote This Morning, as One Line</title><link>https://www.rustbites.com/posts/bite-285/</link><pubDate>Mon, 27 Jul 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-285/</guid><description>&lt;p&gt;That match-on-&lt;code&gt;try_recv&lt;/code&gt; drain loop from &lt;a href="https://www.rustbites.com/posts/bite-284/"&gt;bite 284&lt;/a&gt;? The standard library already wrote it for you: &lt;code&gt;try_iter&lt;/code&gt; yields every pending message and stops the moment the channel is empty.&lt;/p&gt;</description></item><item><title>284. try_recv — Poll the Channel Without Stalling the Loop</title><link>https://www.rustbites.com/posts/bite-284/</link><pubDate>Mon, 27 Jul 2026 09:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-284/</guid><description>&lt;p&gt;Your render loop can&amp;rsquo;t afford to block on &lt;code&gt;recv()&lt;/code&gt; — but it still needs to pick up messages. &lt;code&gt;try_recv&lt;/code&gt; checks the channel and returns immediately, message or not.&lt;/p&gt;</description></item><item><title>283. recv_timeout — Wait for a Message, But Not Forever</title><link>https://www.rustbites.com/posts/bite-283/</link><pubDate>Sun, 26 Jul 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-283/</guid><description>&lt;p&gt;&lt;code&gt;rx.recv()&lt;/code&gt; blocks until a message arrives — and if the producer hangs, so do you. &lt;code&gt;recv_timeout&lt;/code&gt; puts a deadline on the wait and tells you &lt;em&gt;why&lt;/em&gt; it ended.&lt;/p&gt;</description></item><item><title>282. mpsc::sync_channel — A Channel That Pushes Back When the Consumer Falls Behind</title><link>https://www.rustbites.com/posts/bite-282/</link><pubDate>Sun, 26 Jul 2026 09:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-282/</guid><description>&lt;p&gt;&lt;code&gt;mpsc::channel()&lt;/code&gt; never says no: a fast producer and a slow consumer means the queue — and your memory — grows without bound. &lt;code&gt;sync_channel(n)&lt;/code&gt; caps the queue and makes the producer wait.&lt;/p&gt;</description></item><item><title>281. mpsc::channel — Send Results Back Instead of Fighting Over a Mutex</title><link>https://www.rustbites.com/posts/bite-281/</link><pubDate>Sat, 25 Jul 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-281/</guid><description>&lt;p&gt;Threads that only &lt;em&gt;produce&lt;/em&gt; values don&amp;rsquo;t need shared state. A channel turns &amp;ldquo;everyone locks the accumulator&amp;rdquo; into &amp;ldquo;everyone mails in their answer.&amp;rdquo;&lt;/p&gt;</description></item></channel></rss>