pin-project-lite
A lightweight version of pin-project written with declarative macros.
This package has a good security score with no known vulnerabilities.
Community Reviews
Zero-overhead pinning utility that just works in production
From an ops perspective, it's perfect: no runtime cost, no allocations, no dependencies beyond proc-macro2 and minimal compilation overhead. The generated code is trivial to inspect and debug. Error messages are clear when you mess up pinning invariants. It has never caused issues under load because there's literally nothing there at runtime—just safe projections.
The API is stable and well-understood. Breaking changes between versions are extremely rare and well-documented. For building async primitives and custom combinators, this is the standard solution. It integrates seamlessly with tokio, futures, and any async runtime without adding dependency bloat.
Best for: Building async primitives, custom Futures/Streams, or any code requiring safe pin-projection with zero runtime cost.
Avoid if: You don't need custom async types or can use higher-level combinators from futures-util instead.
Essential pin projection with minimal friction and excellent ergonomics
Day-to-day usage is excellent. The macro syntax is intuitive and feels like native Rust. Error messages are clear when you violate pinning invariants, pointing directly to problematic field access. The crate documentation includes precise examples of both simple and complex use cases, including Drop implementation patterns. IDE support works flawlessly since it's pure declarative macros - no proc-macro black magic that confuses rust-analyzer.
The main limitation is intentional: it doesn't support some advanced features like `!Unpin` impls or where-clause configurations that full pin-project offers. For 95% of async runtime and combinator implementations, these restrictions don't matter. The compile-time performance gain is noticeable in larger projects.
Best for: Building async combinators, futures, and streams where you need safe structural pinning without procedural macro overhead.
Avoid if: You need advanced pin-project features like !Unpin enforcement, project_replace, or complex generic bounds on projections.
Ergonomic Pin Projection with Minimal Compile-Time Overhead
The error messages are remarkably clear for a macro-based library. When you forget to mark a field as pinned or try to move out of a pinned field, the compiler errors point directly to the issue with helpful context. The documentation includes practical examples of implementing Future and Stream, which are the primary use cases. IDE support works well since it's a declarative macro, though you won't get autocompletion inside the macro itself.
Day-to-day, it just works. Once you understand Rust's pinning semantics (the real learning curve), pin-project-lite makes implementing pin-safe types trivial. It's a focused tool that solves one problem exceptionally well without feature bloat.
Best for: Projects needing safe pin projections in async code where compile times matter and you understand Rust's pinning model.
Avoid if: You need advanced features like enum support or custom Drop implementations (use full pin-project instead).
Sign in to write a review
Sign In