Developing VK.com web API DSL with macros
summary
A Rust DSL named VK RS generates URL-encoded VK.com API calls via macros, using serde for payloads and reqwest for HTTP, encoding API version and permission per endpoint. Implementation claims cover about 100–150 of ~400 endpoints, produces documentation with links to vk.com, handles lifetimes and generics inside macros, and serializes vectors/options into query strings. A central request macro emits builder-pattern structs and defaults; the codebase ends up as 500+ lines of macros and runs on stable Rust with procedural macro support.
AI-written summary · about
chapters (14)
- 0:00Start
- 0:27Who am I?
- 3:02Why DSL?
- 4:07Basic architecture
- 7:18API call example
- 8:11Response example
- 8:27Simple request description
- 10:39Problems
- 12:00Solution: other macro for reference types
- 13:24Solution: a set of standard conversions
- 14:13Solution: use #[doc] attributes in macros directly
- 15:18Most common input syntax of request! macro
- 15:33Most common input syntax of request_ref macro
- 16:35Codegen? No, procedural macros!
related talks
31mRustly typed APIs; ... JSON RPC with Rust, Procedural macros and a DSL
29mMacromancy: an introduction to Rust macros
59mPavex: re-imaging what API development looks like in Rust
28mGenerating ergonomic C++ APIs using Rustdoc, procedural macros, and Serde
24mMacros for a More Productive Rust
24mGenerating ergonomic C++ APIs using Rustdoc, procedural macros, and Serde
18mImpractical Macros
39mRust metaprogramming - macro_rules! beyond basics
