Pinning in Rust 235 Structural pinning is connected to pin projections in the sense that, if you have Pin<&mut T> where T has one field, a, that can be moved freely and one that can't be moved, b, you can do the following: Write a pin projection for a with the fn a(self: Pin<&mut self>)-> &A signature. In this case, we say that pinning is not structural. Write a projection for b that looks like fn b(self: Pin<&mut self>)-> Pin<&mut B>, in which case we say that pinning is structural for b since it's pinned when the struct, T, is pinned. With the most important definitions out of the way, let's look at the two ways we can pin a value. Pinning to the heap Note The small code snippets we'll present here can be found in this book's Git Hub repository in the ch09/d-pin folder. The different examples are implemented as different methods that you comment/uncomment in the main function. Let's write a small example to illustrate the different ways of pinning a value: ch09/d-pin/src/main. rs use std::{marker::Phantom Pinned, pin::Pin}; #[derive(Default)] struct Foo { a: Maybe Self Ref, b: String, } So, we want to be able to create an instance using Maybe Self Ref::default() that we can move around as we wish, but then at some point initialize it to a state where it references itself; moving it would cause problems.