<story><title>Trivia About Rust Types</title><url>https://www.thecodedmessage.com/posts/trivia-rust-types/</url></story><parent_chain></parent_chain><comment><author>tialaramex</author><text>ControlFlow &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;doc.rust-lang.org&amp;#x2F;core&amp;#x2F;ops&amp;#x2F;enum.ControlFlow.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;doc.rust-lang.org&amp;#x2F;core&amp;#x2F;ops&amp;#x2F;enum.ControlFlow.html&lt;/a&gt; is awesome.&lt;p&gt;Aside from its actual purpose (as part of making ? less magic, described in this trivia list) it&amp;#x27;s good to agree how to talk about control flow in the type system. If two unrelated pieces of software both care about control flow, in a lot of languages they&amp;#x27;d both make up their own ways to signal &amp;quot;keep going&amp;quot; versus &amp;quot;halt&amp;quot;. But since core::ops::ControlFlow exists in Rust it makes sense to use that, and so you spend less time writing adaptors. This is one of the main purposes of a standard library (notice this is in &lt;i&gt;core&lt;/i&gt; not just &lt;i&gt;std&lt;/i&gt; and so it&amp;#x27;s available even in a tiny embedded device with no allocator if you want it)</text></comment>
<story><title>Trivia About Rust Types</title><url>https://www.thecodedmessage.com/posts/trivia-rust-types/</url></story><parent_chain></parent_chain><comment><author>RcouF1uZ4gsC</author><text>&amp;gt; Did you know that Option&amp;lt;T&amp;gt; implements IntoIterator yielding 0&amp;#x2F;1 elements, and you can then call Iterator::flatten to make that be 0&amp;#x2F;n elements if T: IntoIterator?&lt;p&gt;I thought this was so cool, being able to treat Option like a 0&amp;#x2F;1 collection.</text></comment>