I wonder if it is possible to automatically wrap rust libraries, to make them 
usable in Nim. What I mean is something like this:
    
    
    rustimport myRustLib
    
    echo myRustLib.foo(123)
    

with myRustLib being a pure rust library. No glue code should be required to be 
written manually. With C that is not possible, because C does not have modules. 
For C one has transform the header to a Nim equivalent for a clean module, or 
one can just exploit the fact that Nim compiles to C and emit calls to the 
include and the C function calls. c2nim is a tool that can help a lot for the 
process to translate the C header, but it is something that cannot be 
implemented 100% correct, and therefore there will always be manual written 
wrappers. But Rust does not have this disadvantage, there are clean modules and 
maybe a compiler plugin can give you all the information you would need to 
generate the required Nim wrapper code 100% reliable and 100% automated.

This would really help to take an advantage of the always growing Rust 
community. 

Reply via email to