Company
Date Published
Aug. 26, 2021
Author
Adam Chalmers
Word count
2375
Language
English
Hacker News points
37

Summary

The text discusses the implementation of async Rust libraries and the concept of self-referential types. It explains how futures work, why they were unsafe initially, and how Pin/Unpin made them safe. The author also demonstrates using Pin/Unpin to write tricky nested futures. He provides a detailed example of implementing a TimedWrapper that wraps an async function and collects metrics about it. The post concludes with a summary of the key points discussed, emphasizing the importance of understanding self-referential types and how Pin/Unpin can be used to write safe code in Rust.