Exploring lending async iterators
summary
Defines a concrete lending async iterator trait that uses a GAT'd AssociatedType item<'a> so the yielded value borrows from the iterator and self must outlive the item; uses Pin and shows pin projection with the pin-project crate to avoid unsafe in many places. Builds a three-state, no-allocation TCP reader for Embassy that returns borrowed slices (works as a prototype, main branch compiles). Requires nightly borrowck/Polonius flags for some combinators and resorts to unsafe pin_unchecked for filter-like adapters.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:06What are lending async iterators
- 8:14Understanding Pin in Rust
- 14:45Implementing lending async iterators
- 19:52TCP reader abstraction
- 23:08Extending lending async iterators
- 34:20Challenges and limitations
- 35:45Rust’s bleeding edge
- 36:51Q&A
related talks
19mPure Borrow: Linear Haskell Meets Rust-Style Borrowing
32mThe First Six Years in the Development of Polonius, an Improved Borrow Checker
26mThe first six years in the development of Polonius
41mType-Driven API Design in Rust
35mPolonius: Either Borrower or Lender Be, but Responsibly
05mEmulating Rust's Borrow Checker in C++
01h 31mTowards Async Everything Part 2 - Scopes, Construction, and Destruction
15mBorrowing From Session Types
