Trying to create a NIF for the onvif-rf library in Rust - (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom

Hi there, I’m trying to create a NIF for the onvif-rf library in rust, I’m getting this error:

== Compilation error in file lib/onvifphx/OnvifrsNif.ex ==
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom
    (elixir 1.14.3) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir 1.14.3) lib/enum.ex:166: Enumerable.reduce/3
    (elixir 1.14.3) lib/enum.ex:4307: Enum.filter/2
    (rustler 0.27.0) lib/rustler/compiler/config.ex:121: Rustler.Compiler.Config.gather_local_crates/4
    (rustler 0.27.0) lib/rustler/compiler/config.ex:99: Rustler.Compiler.Config.external_resources/3
    (rustler 0.27.0) lib/rustler/compiler/config.ex:70: Rustler.Compiler.Config.build/1
    (rustler 0.27.0) lib/rustler/compiler.ex:9: Rustler.Compiler.compile_crate/2
    lib/onvifphx/OnvifrsNif.ex:4: (module)

I tried to load the onvif lib from onvif-rs in dependencies as it follow:
[dependencies]
onvif= { path =“./src/onvifrsmain/onvif/”}

Thanks!

This is in the Cargo.toml of the native/ folder created by rustler.

Show us your OnivrsNif module

OnvifrsNif:

defmodule OnvifrsNif do
  use Rustler, otp_app: :onvifphx, crate: "onvifrsnif"

  # When your NIF is loaded, it will override this function.
  def add(_a, _b), do: :erlang.nif_error(:nif_not_loaded)
  def mult(_a, _b), do: :erlang.nif_error(:nif_not_loaded)
  #def disco(), do: :erlang.nif_error(:nif_not_loaded)
end

Cargo.toml:

[package]
name = "onvifrsnif"
version = "0.1.0"
authors = []
edition = "2021"

[lib]
name = "onvifrsnif"
path = "src/lib.rs"
crate-type = ["cdylib"]

[dependencies]
rustler = "0.27.0"

onvif= { path ="/…/onvifphx/native/onvifrsnif/src/onvifrsmain/onvif/"}
#onvif= { path ="./src/onvifrsmain/onvif/"}
#schema= { path = "../onvifrsnif/src/onvifrsmain/schema/"}

I was looking for a way to import all the functions from the onvif-rs to elixir, like a wrapper…not sure if is possible.