Type-safe dynamic dispatch
If you’ve ever looked at Rust MCP server code and seen ToolRouter<Self>, you might have been like “wtf, how can a struct contain itself? Isn’t that circular?” Let’s break down this elegant pattern that’s actually simpler than it looks. This does involve function pointers, which leads on to “why do we even want to use […]