rebar3_otter__cargo (rebar3_otter v0.3.0)

Cargo invocation and cdylib artifact resolution.

This module handles all interaction with the Rust toolchain. It is independent of the rebar3 provider API.

The build pins cargo's --target-dir to <crate>/target and computes the output cdylib path by convention rather than parsing cargo's JSON output. cdylib final artifacts are not content-hashed, so the name is deterministic (lib<name>.so / .dylib, <name>.dll), and pinning the target dir makes its location a guarantee instead of a guess. This also keeps artifact resolution free of the stdlib json module (no JSON to parse).

Summary

Functions

Remove the crate's build output.

Platform-appropriate filename for a NIF shared library.

Functions

build(CratePath, Name, Mode, Features, Target)

-spec build(string(), string(), release | debug, [string()], string() | undefined) ->
               {ok, string()} | {error, term()}.

clean(CratePath)

-spec clean(string()) -> ok.

Remove the crate's build output.

The build pins --target-dir to <crate>/target, so cleaning is just removing that directory — exact in scope and independent of cargo (so it works even without a toolchain installed).

nif_filename(Name)

-spec nif_filename(string()) -> string().

Platform-appropriate filename for a NIF shared library.

.dll on Windows, .so everywhere else (including macOS, where Erlang expects .so rather than .dylib).