Skip to content

Pinning

Category: Async · Status: stub · Lessons: chapter 06, Async (planned)

One line: Rust's guarantee that a value will not move in memory, needed because an async state machine may hold pointers into itself.

Also called: Pin, Unpin.

How it connects

In each language

Rust Pin keeps a pointee from being moved unless it implements Unpin
C# a different pinning: fixed stops the garbage collector from relocating a variable while a pointer to it is in use, and so does a Pinned GCHandle

Where to read more