BirdNest Tech Talk
Aug 28, 2024 · Backend Development
How to Provide Both Async and Sync APIs in a Rust Library Without Duplicating Code
This article walks through the challenges of offering both asynchronous and synchronous interfaces for a Rust API client, evaluates naive copy‑paste solutions, explores runtime‑based wrappers and the maybe_async procedural macro, and finally presents a clean, feature‑flagged design that avoids code duplication and compile‑time overhead.
AsyncRustcargo
0 likes · 23 min read
