<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Atomicity on rustbites</title><link>https://www.rustbites.com/tags/atomicity/</link><description>Recent content in Atomicity on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 20 Jul 2026 22:04:45 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/atomicity/index.xml" rel="self" type="application/rss+xml"/><item><title>271. fs::rename — Replace a File Atomically, Never Expose a Half-Write</title><link>https://www.rustbites.com/posts/bite-271/</link><pubDate>Mon, 20 Jul 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-271/</guid><description>&lt;p&gt;&lt;code&gt;fs::write&lt;/code&gt; truncates the file &lt;em&gt;before&lt;/em&gt; writing. Crash halfway — or get read halfway — and the world sees a torn file. &lt;code&gt;fs::rename&lt;/code&gt; is the atomic swap that fixes it.&lt;/p&gt;</description></item></channel></rss>