Rust interop

Nim and Rust are both statically typed, compiled languages capable of "systems programming".

Because of these similarities, interop between Nim and rust is generally straightforward and handled the same way as C interop in both languages: Rust code is exported to C then imported in Nim as C code and vice versa.


While Nim is a GC-first language, rust in general uses lifetime tracking (via Box) and / or reference counting (via Rc/Arc) outside of "simple" memory usage.

When used with Nim, care must be taken to extend the lifetimes of Nim objects via GC_ref / GC_unref.