Composable ExUnit helpers for Rust generated by defrust and defnif.
The helpers return source or boolean values so tests keep using ExUnit's
ordinary assert macro, pattern matching, and diffs:
defmodule MyApp.NativeTest do
use RustQ.Test, async: true
test "generates and exports the native boundary" do
assert rust_source!(MyApp.Native, :sum_impl) =~ "fn sum_impl"
assert nif_exported?(MyApp.Native, :sum, 1)
assert RustQ.valid?(rust_source!(MyApp.Native), "my_app_native.rs")
end
endrust_source!/1 returns a module's complete generated Rust.
rust_source!/2 renders one named generated function, which keeps source
assertions focused and prevents matches across unrelated functions.
Summary
Functions
Returns whether a function is exported to Elixir and marked as a Rustler NIF.
Returns a generated module's complete Rust source or raises.
Renders one named generated Rust function or raises.
Functions
Returns whether a function is exported to Elixir and marked as a Rustler NIF.
Returns a generated module's complete Rust source or raises.
Renders one named generated Rust function or raises.