Is there anything like this for Rust or C++?

I like the idea of code generation instead of doing the work at runtime (like in ORMs). This is like making your database schema the IDL spec.

https://github.com/launchbadge/sqlx perhaps

Also hugsql for clojure and pugsql for python.