The post discusses the feasibility and implementation of move constructors in Rust, a feature standard in C++ but not inherently supported in Rust. It addresses the challenges of memory safety and interoperability between Rust and C++, particularly focusing on the Foreign Function Interface (FFI). The author presents a prototype solution using macros and explores concepts like pinned pointers, stack pinning, and construction in place. The solution aims to bridge the gap for efficient C++ integration without heap allocations.
Table of contents
The Interop ProblemPinned PointersConstructorsInterlude I: Pinning on the StackThe Return Value OptimizationTowards Move Constructors: Copy ConstructorsInterlude II: Unique OwnershipOwning the StackMove ConstructorsThe Langauge-Lawyering PartThe UpshotFuture WorkSort: