<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Phantom-Data on rustbites</title><link>https://www.rustbites.com/tags/phantom-data/</link><description>Recent content in Phantom-Data on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Wed, 27 May 2026 10:43:13 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/phantom-data/index.xml" rel="self" type="application/rss+xml"/><item><title>165. PhantomData&lt;T&gt; — The Zero-Sized Marker That Pretends to Own a T</title><link>https://www.rustbites.com/posts/bite-165/</link><pubDate>Wed, 27 May 2026 09:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-165/</guid><description>&lt;p&gt;You write a generic struct, never actually store a &lt;code&gt;T&lt;/code&gt; in any field, and the compiler stops you with &lt;em&gt;&amp;ldquo;parameter &lt;code&gt;T&lt;/code&gt; is never used&amp;rdquo;&lt;/em&gt;. &lt;code&gt;PhantomData&amp;lt;T&amp;gt;&lt;/code&gt; is the zero-cost lie that fixes it — a marker that occupies no bytes but tells the compiler &amp;ldquo;act as if I own a &lt;code&gt;T&lt;/code&gt;.&amp;rdquo;&lt;/p&gt;</description></item></channel></rss>