简体   繁体   English

在 Zig 中实施 ERTS NIF 的工作流程是什么?

[英]What is the workflow for implementing ERTS NIFs in Zig?

What is the workflow for implementing ERTS NIFs in Zig?在 Zig 中实施ERTS NIF的工作流程是什么?

Is there something comparable to Rustler for NIFs authored in Rust?对于用 Rust 编写的NIF ,是否有与Rustler相媲美的东西?

The Zigler package can be used: https://github.com/ityonemo/zigler , https://hex.pm/packages/zigler所述齐格勒包可用于: https://github.com/ityonemo/ziglerhttps://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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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