RTK – query your Rust codebase and make bindings anywhere

1 reaching4jack 1 6/27/2025, 5:39:42 PM github.com ↗

Comments (1)

reaching4jack · 4h ago
Hello HN!

As a long-time professional Rust developer. I've always been frustrated by the difficulty and "hackiness" of producing bindings to other languages, whether a frontend, an FFI library, etc.

Not just in Rust but in any language.

After many years of trying existing solutions and trying to make my own, I've finally developed a solution I'm very happy with.

RTK (aka Rust Type Kit) allows you to write Lua scripts that perform queries on your code, such as method calls to Axum's `.route`, function definitions, and more, and then receive rich type information including all argument types, function paths, proc macro attributes, and more.

Your Lua script can then read this information and emit an output file in any language of your choosing. Or, you can emit compiler errors and use it as a linter of sorts. You can even directly re-emit Rust code itself and use this as a richer proc macro solution!

The code example is a bit verbose, so I encourage you to take a look at the repo's README. I look forward to hearing your thoughts, or any usecases you may come up with!