<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pin on rustbites</title><link>https://www.rustbites.com/tags/pin/</link><description>Recent content in Pin 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/pin/index.xml" rel="self" type="application/rss+xml"/><item><title>162. Pin&lt;P&gt; — The Pointer Type That Says 'This Won't Move'</title><link>https://www.rustbites.com/posts/bite-162/</link><pubDate>Tue, 26 May 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-162/</guid><description>&lt;p&gt;Self-referential structs are the obvious &amp;ldquo;this should work but doesn&amp;rsquo;t&amp;rdquo; pattern in Rust: a struct that holds a buffer plus a reference into that buffer falls apart the moment it moves and the reference dangles. &lt;code&gt;Pin&amp;lt;P&amp;gt;&lt;/code&gt; is the type that says &amp;ldquo;the pointee is fixed in memory&amp;rdquo; — and is the reason every &lt;code&gt;async fn&lt;/code&gt; future you&amp;rsquo;ve ever &lt;code&gt;.await&lt;/code&gt;ed can keep a pointer to its own local variables.&lt;/p&gt;</description></item><item><title>164. Pin projection — How to actually use the fields behind Pin&lt;&amp;mut Self&gt;</title><link>https://www.rustbites.com/posts/bite-164/</link><pubDate>Tue, 26 May 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-164/</guid><description>&lt;p&gt;The moment you hand-roll &lt;code&gt;Future::poll&lt;/code&gt;, you have a &lt;code&gt;Pin&amp;lt;&amp;amp;mut Self&amp;gt;&lt;/code&gt; and a question Rust won&amp;rsquo;t answer for you: how do I touch my fields? &lt;code&gt;self.inner&lt;/code&gt; doesn&amp;rsquo;t compile, &lt;code&gt;&amp;amp;mut self.inner&lt;/code&gt; is what &lt;code&gt;Pin&lt;/code&gt; exists to prevent, and the answer — &lt;em&gt;pin projection&lt;/em&gt; — is one of those idioms everyone reinvents until they reach for &lt;code&gt;pin-project-lite&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>