简体   繁体   中英

What is the workflow for implementing ERTS NIFs in Zig?

What is the workflow for implementing ERTS NIFs in Zig?

Is there something comparable to Rustler for NIFs authored in Rust?

The Zigler package can be used: https://github.com/ityonemo/zigler , https://hex.pm/packages/zigler

defmodule ExampleZig do
  use Zig
  ~Z"""
  /// nif: example_fun/2
  fn example_fun(value1: f64, value2: f64) bool {
    return value1 > value2;
  }
  """
end

test "example nifs" do
  assert ExampleZig.example_fun(0.8, -0.8)
  refute ExampleZig.example_fun(0.1, 0.4)
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM