rusterlium / rustler

Safe Rust bridge for creating Erlang NIF functions
https://docs.rs/crate/rustler
Apache License 2.0
4.32k stars 225 forks source link

NIF Inspection Tool #614

Open filmor opened 4 months ago

filmor commented 4 months ago

Initial PoC for a tool that takes a compiled NIF library and reads back its information. This could be used to automatically generate a matching Erlang (rebar3_cargo) or Elixir (Rustler) module. Could be a dead end, but I don't like the current ergonomics of the wrapper modules.

hansihe commented 4 months ago

An alternate approach here might be to serialize the configuration and embed it in the binary as a symbol. We could then just read it directly from the binary, without having to load it.

I think this would have a few advantages:

filmor commented 4 months ago

Any example of what you are thinking of? With the NIF discovery merged, the NIF collection will only be known when loading the library (which is how NIF linraries work on general).