<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ffi on rustbites</title><link>https://www.rustbites.com/tags/ffi/</link><description>Recent content in Ffi on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 11 May 2026 09:32:11 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/ffi/index.xml" rel="self" type="application/rss+xml"/><item><title>131. mem::offset_of! — Byte Offsets Without the memoffset Crate</title><link>https://www.rustbites.com/posts/bite-131/</link><pubDate>Sun, 10 May 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-131/</guid><description>&lt;p&gt;You need the byte offset of a field — for FFI, custom serialization, or talking to a C struct. The old answer was &lt;code&gt;unsafe&lt;/code&gt; pointer arithmetic on a &lt;code&gt;MaybeUninit&lt;/code&gt;, or pulling in the &lt;code&gt;memoffset&lt;/code&gt; crate. &lt;code&gt;std::mem::offset_of!&lt;/code&gt; is the safe, one-liner replacement.&lt;/p&gt;</description></item></channel></rss>