<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>State-Machine on rustbites</title><link>https://www.rustbites.com/tags/state-machine/</link><description>Recent content in State-Machine on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 24 Apr 2026 10:36:32 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/state-machine/index.xml" rel="self" type="application/rss+xml"/><item><title>99. std::mem::replace — Swap a Value and Keep the Old One</title><link>https://www.rustbites.com/posts/bite-099/</link><pubDate>Thu, 23 Apr 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-099/</guid><description>&lt;p&gt;&lt;code&gt;mem::take&lt;/code&gt; is great until your type doesn&amp;rsquo;t have a sensible &lt;code&gt;Default&lt;/code&gt;. That&amp;rsquo;s where &lt;code&gt;mem::replace&lt;/code&gt; steps in — you pick what gets left behind, and you still get the old value out of a &lt;code&gt;&amp;amp;mut&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>